From 510d90a60ccbd8dd29d844f065a04df505f27115 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 19 May 2023 15:53:28 +0200 Subject: [PATCH] Convert project to use pyproject.toml --- .gitlab-ci.yml | 12 +++++------- README.rst | 2 +- pyproject.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ setup.py | 46 ++-------------------------------------------- 4 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 pyproject.toml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b04363e..b00acb4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,11 @@ pypi: script: - cp /keys/.pypirc ~/.pypirc - - virtualenv env - - source env/bin/activate - - XDG_CACHE_HOME=/cache pip3 install -U pip wheel setuptools twine - - XDG_CACHE_HOME=/cache pip3 install -U pretix - - XDG_CACHE_HOME=/cache pip3 install -U pkginfo==1.8.3 # Work around https://github.com/pypa/twine/issues/940 - - python setup.py develop - - python setup.py sdist bdist_wheel + - virtualenv /tmp/env + - source /tmp/env/bin/activate + - XDG_CACHE_HOME=/cache pip3 install -U pip wheel setuptools twine build pretix-plugin-build + - python -m build + - check-manifest . - twine check dist/* - twine upload dist/* tags: diff --git a/README.rst b/README.rst index c6a4a73..18de57d 100644 --- a/README.rst +++ b/README.rst @@ -12,7 +12,7 @@ Development setup 3. Activate the virtual environment you use for pretix development. -4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry. +4. Execute ``pip install -e .`` within this directory to register this application with pretix's plugin registry. 5. Execute ``make`` within this directory to compile translations. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..28e9ae8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[project] +name = "pretix-servicefees" +dynamic = ["version"] +description = "Allows you to impose a service fee on all non-free orders." +readme = "README.rst" +requires-python = ">=3.9" +license = {file = "LICENSE"} +keywords = ["pretix"] +authors = [ + {name = "pretix team", email = "support@pretix.eu"}, +] +maintainers = [ + {name = "pretix team", email = "support@pretix.eu"}, +] + +dependencies = [ + +] + +[project.entry-points."pretix.plugin"] +pretix_servicefees = "pretix_servicefees:PretixPluginMeta" + +[project.entry-points."distutils.commands"] +build = "pretix_plugin_build.build:CustomBuild" + +[build-system] +requires = [ + "setuptools", + "pretix-plugin-build", +] + +[project.urls] +homepage = "https://github.com/pretix/pretix-servicefees" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.dynamic] +version = {attr = "pretix_servicefees.__version__"} + +[tool.setuptools.packages.find] +include = ["pretix*"] +namespaces = false diff --git a/setup.py b/setup.py index 08fb58c..6068493 100644 --- a/setup.py +++ b/setup.py @@ -1,45 +1,3 @@ -import os -from distutils.command.build import build +from setuptools import setup -from django.core import management -from setuptools import setup, find_packages -from pretix_servicefees import __version__ - - -try: - with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f: - long_description = f.read() -except: - long_description = '' - - -class CustomBuild(build): - def run(self): - management.call_command('compilemessages', verbosity=1) - build.run(self) - - -cmdclass = { - 'build': CustomBuild -} - - -setup( - name='pretix-servicefees', - version=__version__, - description='Allows you to impose a service fee on all non-free orders.', - long_description=long_description, - url='https://github.com/pretix/pretix-servicefees', - author='Raphael Michel', - author_email='michel@rami.io', - license='Apache Software License', - - install_requires=[], - packages=find_packages(exclude=['tests', 'tests.*']), - include_package_data=True, - cmdclass=cmdclass, - entry_points=""" -[pretix.plugin] -pretix_servicefees=pretix_servicefees:PretixPluginMeta -""", -) +setup()