-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from ministryofjustice/declarative-build
Migrate to modern/declarative packaging
- Loading branch information
Showing
15 changed files
with
201 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
build | ||
twine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
import argparse | ||
import logging | ||
import os | ||
import pathlib | ||
import sys | ||
|
||
from django.core.management import call_command | ||
|
||
|
||
def main(): | ||
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') | ||
|
||
parser = argparse.ArgumentParser(description='Manage gettext localisation messages') | ||
sub_parsers = parser.add_subparsers() | ||
description = 'Update localisation message files from source code' | ||
sub_parser = sub_parsers.add_parser('update', help=description, description=description) | ||
sub_parser.set_defaults(command='update') | ||
description = 'Compile gettext binary localisation message files' | ||
sub_parser = sub_parsers.add_parser('compile', help=description, description=description) | ||
sub_parser.set_defaults(command='compile') | ||
|
||
args = parser.parse_args() | ||
if not hasattr(args, 'command'): | ||
parser.print_help() | ||
sys.exit(1) | ||
|
||
root_path = pathlib.Path(__file__).parent.parent | ||
os.chdir(root_path / 'zendesk_tickets') | ||
|
||
if args.command == 'update': | ||
logging.info('Updating localisation message files') | ||
call_command('makemessages', all=True, no_wrap=True, keep_pot=True) | ||
|
||
if args.command == 'compile': | ||
logging.info('Compiling localisation message files') | ||
call_command('compilemessages', fuzzy=False) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,49 @@ | ||
[metadata] | ||
name = django-zendesk-tickets | ||
version = attr: zendesk_tickets.__version__ | ||
url = https://github.com/ministryofjustice/django-zendesk-tickets | ||
author = Ministry of Justice Digital & Technology | ||
author_email = [email protected] | ||
description = Django views and forms that submit tickets to Zendesk | ||
long_description = file: README.rst | ||
license = MIT | ||
keywords = | ||
django | ||
tickets | ||
zendesk | ||
classifiers = | ||
Development Status :: 4 - Beta | ||
Framework :: Django | ||
Framework :: Django :: 2.2 | ||
Framework :: Django :: 3.0 | ||
Framework :: Django :: 3.1 | ||
Framework :: Django :: 3.2 | ||
Framework :: Django :: 4.0 | ||
Framework :: Django :: 4.1 | ||
Intended Audience :: Developers | ||
License :: OSI Approved :: MIT License | ||
Natural Language :: English | ||
Operating System :: OS Independent | ||
Programming Language :: Python :: 3 | ||
Programming Language :: Python :: 3 :: Only | ||
Programming Language :: Python :: 3.8 | ||
Programming Language :: Python :: 3.9 | ||
Programming Language :: Python :: 3.10 | ||
Programming Language :: Python :: 3.11 | ||
|
||
[options] | ||
; NB: looser python version requirement than what's tested | ||
python_requires = >=3.6 | ||
packages = | ||
zendesk_tickets | ||
zendesk_tickets.locale.cy.LC_MESSAGES | ||
zendesk_tickets.locale.en_GB.LC_MESSAGES | ||
zendesk_tickets.templates.zendesk_tickets | ||
include_package_data = true | ||
install_requires = | ||
Django>=2.2,<4.3 | ||
requests | ||
|
||
[flake8] | ||
exclude = .git/,.eggs/,.tox/,build/,dist/,env/,venv/ | ||
max-complexity = 10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,10 @@ | ||
#!/usr/bin/env python | ||
import importlib | ||
import os | ||
import sys | ||
import warnings | ||
|
||
from setuptools import setup | ||
|
||
if sys.version_info[0:2] < (3, 8): | ||
warnings.warn('This package is tested with Python version 3.8+', stacklevel=1) | ||
warnings.warn('This package is only tested on Python version 3.8+', stacklevel=1) | ||
|
||
root_path = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
with open(os.path.join(root_path, 'README.rst')) as readme: | ||
README = readme.read() | ||
|
||
package_info = importlib.import_module('zendesk_tickets') | ||
setup_extensions = importlib.import_module('zendesk_tickets.setup_extensions') | ||
command_classes = setup_extensions.command_classes.copy() | ||
|
||
setup( | ||
name='django-zendesk-tickets', | ||
version=package_info.__version__, | ||
author=package_info.__author__, | ||
author_email='[email protected]', | ||
url='https://github.com/ministryofjustice/django-zendesk-tickets', | ||
packages=[ | ||
'zendesk_tickets', | ||
'zendesk_tickets.locale.cy.LC_MESSAGES', | ||
'zendesk_tickets.locale.en_GB.LC_MESSAGES', | ||
'zendesk_tickets.templates.zendesk_tickets', | ||
], | ||
include_package_data=True, | ||
license='MIT', | ||
description='Django views and forms that submit tickets to Zendesk', | ||
long_description=README, | ||
keywords='zendesk django tickets', | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Framework :: Django', | ||
'Framework :: Django :: 2.2', | ||
'Framework :: Django :: 3.0', | ||
'Framework :: Django :: 3.1', | ||
'Framework :: Django :: 3.2', | ||
'Framework :: Django :: 4.0', | ||
'Framework :: Django :: 4.1', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Natural Language :: English', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.8', | ||
'Programming Language :: Python :: 3.9', | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
], | ||
cmdclass=command_classes, | ||
python_requires='>=3.6', # looser requirement than what's tested | ||
setup_requires=['Django>=2.2,<4.3'], | ||
install_requires=['Django>=2.2,<4.3', 'requests'], | ||
tests_require=[], | ||
test_suite='tests.run', | ||
) | ||
setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +0,0 @@ | ||
import os | ||
import sys | ||
|
||
import django | ||
from django.conf import settings | ||
from django.test.runner import DiscoverRunner | ||
|
||
test_settings = dict( | ||
DEBUG=True, | ||
SECRET_KEY='a' * 50, | ||
ROOT_URLCONF='tests.urls', | ||
INSTALLED_APPS=( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'zendesk_tickets', | ||
), | ||
MIDDLEWARE=[ | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
], | ||
SESSION_ENGINE='django.contrib.sessions.backends.signed_cookies', | ||
TEMPLATES=[{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [os.path.join(os.path.dirname(__file__), 'templates')], | ||
'APP_DIRS': True, | ||
}], | ||
ZENDESK_BASE_URL='https://zendesk.local/', | ||
ZENDESK_API_USERNAME='zendesk_user', | ||
ZENDESK_API_TOKEN='api_token', | ||
ZENDESK_REQUESTER_ID=111111, | ||
ZENDESK_GROUP_ID=222222, | ||
ZENDESK_CUSTOM_FIELDS={ | ||
'referer': 31, | ||
'username': 32, | ||
'user_agent': 33, | ||
'contact_email': 34, | ||
}, | ||
) | ||
|
||
|
||
def run(): | ||
if not settings.configured: | ||
settings.configure(**test_settings) | ||
django.setup() | ||
failures = DiscoverRunner(verbosity=2, failfast=False, interactive=False).run_tests(['tests']) | ||
sys.exit(failures) | ||
|
||
|
||
if __name__ == '__main__': | ||
run() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import pathlib | ||
import sys | ||
|
||
if __name__ == '__main__': | ||
import django | ||
from django.conf import settings | ||
from django.test.runner import DiscoverRunner | ||
|
||
tests_path = pathlib.Path(__file__).parent | ||
root_path = tests_path.parent | ||
|
||
test_settings = dict( | ||
DEBUG=True, | ||
SECRET_KEY='a' * 50, | ||
ROOT_URLCONF='tests.urls', | ||
INSTALLED_APPS=( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'zendesk_tickets', | ||
), | ||
MIDDLEWARE=[ | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
], | ||
SESSION_ENGINE='django.contrib.sessions.backends.signed_cookies', | ||
TEMPLATES=[{ | ||
'BACKEND': 'django.template.backends.django.DjangoTemplates', | ||
'DIRS': [tests_path / 'templates'], | ||
'APP_DIRS': True, | ||
}], | ||
ZENDESK_BASE_URL='https://zendesk.local/', | ||
ZENDESK_API_USERNAME='zendesk_user', | ||
ZENDESK_API_TOKEN='api_token', | ||
ZENDESK_REQUESTER_ID=111111, | ||
ZENDESK_GROUP_ID=222222, | ||
ZENDESK_CUSTOM_FIELDS={ | ||
'referer': 31, | ||
'username': 32, | ||
'user_agent': 33, | ||
'contact_email': 34, | ||
}, | ||
) | ||
|
||
if not settings.configured: | ||
settings.configure(**test_settings) | ||
django.setup() | ||
|
||
test_runner = DiscoverRunner(verbosity=2, failfast=False, interactive=False, top_level=root_path) | ||
failures = test_runner.run_tests(['tests']) | ||
sys.exit(failures) |
Oops, something went wrong.