Skip to content

Commit 5097c5c

Browse files
committed
Initial commit
0 parents  commit 5097c5c

38 files changed

+1373
-0
lines changed

.github/workflows/style.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- 'pretix_dbevent/locale/**'
8+
- 'pretix_dbevent/static/**'
9+
pull_request:
10+
branches: [ main, master ]
11+
paths-ignore:
12+
- 'pretix_dbevent/locale/**'
13+
- 'pretix_dbevent/static/**'
14+
15+
jobs:
16+
isort:
17+
name: isort
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python 3.11
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: 3.11
25+
- uses: actions/cache@v4
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
- name: Install pretix
32+
run: pip3 install pretix
33+
- name: Install Dependencies
34+
run: pip3 install isort -Ue .
35+
- name: Run isort
36+
run: isort -c .
37+
flake:
38+
name: flake8
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Set up Python 3.11
43+
uses: actions/setup-python@v1
44+
with:
45+
python-version: 3.11
46+
- uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/pip
49+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
50+
restore-keys: |
51+
${{ runner.os }}-pip-
52+
- name: Install pretix
53+
run: pip3 install pretix
54+
- name: Install Dependencies
55+
run: pip3 install flake8 -Ue .
56+
- name: Run flake8
57+
run: flake8 .
58+
working-directory: .
59+
black:
60+
name: black
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v2
64+
- name: Set up Python 3.11
65+
uses: actions/setup-python@v1
66+
with:
67+
python-version: 3.11
68+
- uses: actions/cache@v4
69+
with:
70+
path: ~/.cache/pip
71+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
72+
restore-keys: |
73+
${{ runner.os }}-pip-
74+
- name: Install pretix
75+
run: pip3 install pretix
76+
- name: Install Dependencies
77+
run: pip3 install black -Ue .
78+
- name: Run black
79+
run: black --check .
80+
working-directory: .
81+
packaging:
82+
name: packaging
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v2
86+
- name: Set up Python 3.11
87+
uses: actions/setup-python@v1
88+
with:
89+
python-version: 3.11
90+
- uses: actions/cache@v4
91+
with:
92+
path: ~/.cache/pip
93+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
94+
restore-keys: |
95+
${{ runner.os }}-pip-
96+
- name: Install pretix
97+
run: pip3 install pretix
98+
- name: Install Dependencies
99+
run: pip3 install twine check-manifest pretix-plugin-build setuptools build -Ue .
100+
- name: Run check-manifest
101+
run: check-manifest .
102+
working-directory: .
103+
- name: Build package
104+
run: python setup.py sdist
105+
working-directory: .
106+
- name: Check package
107+
run: twine check dist/*
108+
working-directory: .

.github/workflows/tests.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- 'pretix_dbevent/locale/**'
8+
pull_request:
9+
branches: [ main, master ]
10+
paths-ignore:
11+
- 'pretix_dbevent/locale/**'
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
name: Tests
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.11
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.11
23+
- uses: actions/cache@v4
24+
with:
25+
path: ~/.cache/pip
26+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
27+
restore-keys: |
28+
${{ runner.os }}-pip-
29+
- name: Install system dependencies
30+
run: sudo apt update && sudo apt install gettext
31+
- name: Install pretix
32+
run: pip3 install pretix
33+
- name: Install Dependencies
34+
run: pip3 install pytest pytest-django -Ue .
35+
- name: Run checks
36+
run: py.test tests

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
.ropeproject/
27+
28+
# PyInstaller
29+
# Usually these files are written by a python script from a template
30+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31+
*.manifest
32+
*.spec
33+
34+
# Installer logs
35+
pip-log.txt
36+
pip-delete-this-directory.txt
37+
38+
# Unit test / coverage reports
39+
htmlcov/
40+
.tox/
41+
.coverage
42+
.coverage.*
43+
.cache
44+
nosetests.xml
45+
coverage.xml
46+
*,cover
47+
.hypothesis/
48+
49+
# Translations
50+
*.mo
51+
52+
# Django stuff:
53+
*.log
54+
data/
55+
56+
# Sphinx documentation
57+
docs/_build/
58+
59+
# PyBuilder
60+
target/
61+
62+
#Ipython Notebook
63+
.ipynb_checkpoints

.gitlab-ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
test:
2+
image:
3+
name: pretix/ci-image
4+
before_script:
5+
- pip install -U pip uv
6+
- uv pip install --system -U wheel setuptools pytest pytest-django coverage
7+
- uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
8+
script:
9+
- uv pip install --system -e .
10+
- make
11+
- coverage run -m pytest tests
12+
- coverage report
13+
variables:
14+
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
15+
XDG_CACHE_HOME: $CI_PROJECT_DIR/.cache
16+
cache:
17+
key:
18+
files:
19+
- pyproject.toml
20+
- setup.py
21+
paths:
22+
- .cache
23+
style:
24+
image:
25+
name: pretix/ci-image
26+
before_script:
27+
- pip install -U pip uv
28+
- uv pip install --system -U wheel setuptools isort black flake8 check-manifest
29+
- uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
30+
script:
31+
- uv pip install --system -e .
32+
- black --check .
33+
- isort -c --gitignore .
34+
- flake8 --extend-exclude .cache .
35+
- check-manifest --ignore .cache .
36+
variables:
37+
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
38+
XDG_CACHE_HOME: $CI_PROJECT_DIR/.cache
39+
cache:
40+
key:
41+
files:
42+
- pyproject.toml
43+
- setup.py
44+
paths:
45+
- .cache
46+
pypi:
47+
image:
48+
name: pretix/ci-image
49+
before_script:
50+
- cat $PYPIRC > ~/.pypirc
51+
- pip install -U pip uv
52+
- uv pip install --system -U wheel setuptools twine build pretix-plugin-build check-manifest
53+
script:
54+
- python -m build
55+
- check-manifest .
56+
- twine check dist/*
57+
- twine upload dist/*
58+
variables:
59+
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip
60+
XDG_CACHE_HOME: $CI_PROJECT_DIR/.cache
61+
cache:
62+
key:
63+
files:
64+
- pyproject.toml
65+
- setup.py
66+
paths:
67+
- .cache
68+
only:
69+
- pypi
70+
artifacts:
71+
paths:
72+
- dist/

.install-hooks.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
REPO_DIR=$(git rev-parse --show-toplevel)
3+
GIT_DIR=$REPO_DIR/.git
4+
VENV_ACTIVATE=$VIRTUAL_ENV/bin/activate
5+
if [[ ! -f $VENV_ACTIVATE ]]
6+
then
7+
echo "Could not find your virtual environment"
8+
fi
9+
10+
echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit
11+
echo "set -e" >> $GIT_DIR/hooks/pre-commit
12+
echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit
13+
echo "black --check ." >> $GIT_DIR/hooks/pre-commit
14+
echo "isort -c ." >> $GIT_DIR/hooks/pre-commit
15+
echo "flake8 ." >> $GIT_DIR/hooks/pre-commit
16+
chmod +x $GIT_DIR/hooks/pre-commit

.update-locales.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
COMPONENTS=pretix/pretix-plugin-pretix-dbevent
3+
DIR=pretix_dbevent/locale
4+
# Renerates .po files used for translating the plugin
5+
set -e
6+
set -x
7+
8+
# Lock Weblate
9+
for c in $COMPONENTS; do
10+
wlc lock $c;
11+
done
12+
13+
# Push changes from Weblate to GitHub
14+
for c in $COMPONENTS; do
15+
wlc commit $c;
16+
done
17+
18+
# Pull changes from GitHub
19+
git pull --rebase
20+
21+
# Update po files itself
22+
make localegen
23+
24+
# Commit changes
25+
git add $DIR/*/*/*.po
26+
git add $DIR/*.pot
27+
28+
git commit -s -m "Update po files
29+
[CI skip]"
30+
31+
# Push changes
32+
git push
33+
34+
# Unlock Weblate
35+
for c in $COMPONENTS; do
36+
wlc unlock $c;
37+
done

LICENSE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Copyright 2024 rami.io GmbH
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
recursive-include pretix_dbevent/static *
2+
recursive-include pretix_dbevent/templates *
3+
recursive-include pretix_dbevent/locale *
4+
include LICENSE
5+
exclude .gitlab-ci.yml

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
all: localecompile
2+
LNGS:=`find pretix_dbevent/locale/ -mindepth 1 -maxdepth 1 -type d -printf "-l %f "`
3+
4+
localecompile:
5+
django-admin compilemessages
6+
7+
localegen:
8+
django-admin makemessages --keep-pot -i build -i dist -i "*egg*" $(LNGS)
9+
10+
.PHONY: all localecompile localegen

README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)