diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..725d50b --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,39 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.dev.txt ]; then python -m pip install -r requirements.dev.txt; fi + python -m pip install build + - name: Build package + run: python -m build --no-isolation + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..b8f7225 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include zanthor * +include README.md +include LICENSE.txt diff --git a/setup.py b/setup.py index 2252678..b460904 100755 --- a/setup.py +++ b/setup.py @@ -1,22 +1,12 @@ -import os -APP_NAME = "zanthor" -DESCRIPTION = open("README.md").read() +from setuptools import setup, find_packages -METADATA = { - "name": APP_NAME, - "version": "1.2.3", - "license": "GPL", - "description": "Zanthor is a game where you play an evil robot castle which is powered by steam. @zanthorgame #python #pygame", - "author": "zanthor.org", - "author_email": "renesd@gmail.com", - "url": "http://www.zanthor.org/", - "classifiers": [ - "Development Status :: 4 - Beta", - "Intended Audience :: End Users/Desktop", - "Intended Audience :: Information Technology", - "License :: OSI Approved :: BSD License", - "Operating System :: OS Independent", +setup( + name='zanthor', + version="1.2.4a1", + classifiers=[ + 'Development Status :: 4 - Beta', + 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", @@ -33,97 +23,25 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Topic :: Software Development :: Libraries :: pygame", + 'Topic :: Software Development :: Libraries :: pygame', + 'Topic :: Games/Entertainment :: Arcade', "Topic :: Games/Entertainment :: Real Time Strategy", ], - "py2exe.target": "", - #'py2exe.icon':'icon.ico', #64x64 - "py2exe.binary": APP_NAME, # leave off the .exe, it will be added - "py2app.target": APP_NAME, - "py2app.icon": "icon.icns", # 128x128 - #'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython', - "cx_freeze.cmd": "cxfreeze", - "cx_freeze.target": "%s_linux" % APP_NAME, - "cx_freeze.binary": APP_NAME, -} - - -cmdclass = {} -PACKAGEDATA = { - "cmdclass": cmdclass, - "package_dir": { - "zanthor": "zanthor", + license='GPL', + author="Aaron, Phil, Rene, Tim", + author_email="renesd@gmail.com", + maintainer='Rene Dudfield', + maintainer_email='renesd@gmail.com', + description="Zanthor is a game where you play an evil robot castle which is powered by steam. @zanthorgame #python #pygame", + url="http://github.com/pygame/zanthor/", + include_package_data=True, + long_description='Zanthor is a game where you play an evil robot castle which is powered by steam.', + package_dir={'zanthor': 'zanthor'}, + packages=find_packages(), + install_requires=['pygame'], + entry_points={ + 'console_scripts': [ + 'zanthor=zanthor.main:main', + ], }, - "packages": [ - "zanthor", - "zanthor.pgu", - "zanthor.pgu.gui", - ], - "scripts": ["scripts/zanthor"], -} - -PACKAGEDATA.update(METADATA) - - -from distutils.core import setup -import sys -import glob -import os -import shutil - -try: - cmd = sys.argv[1] -except IndexError: - print("Usage: setup.py install|sdist") - raise SystemExit - - -# utility for adding subdirectories -def add_files(dest, generator): - for dirpath, dirnames, filenames in generator: - for name in "CVS", ".svn": - if name in dirnames: - dirnames.remove(name) - - for name in filenames: - if "~" in name: - continue - suffix = os.path.splitext(name)[1] - if suffix in (".pyc", ".pyo"): - continue - if name[0] == ".": - continue - filename = os.path.join(dirpath, name) - dest.append(filename) - - -# define what is our data -_DATA_DIR = os.path.join("zanthor", "data") -data = [] -add_files(data, os.walk(_DATA_DIR)) - - -# data_dirs = [os.path.join(f2.replace(_DATA_DIR, 'data'), '*') for f2 in data] -data_dirs = [os.path.join(f2.replace(_DATA_DIR, "data")) for f2 in data] -PACKAGEDATA["package_data"] = {"zanthor": data_dirs} - - -data.extend(glob.glob("*.txt")) -data.extend(glob.glob("*.md")) -# data.append('MANIFEST.in') -# define what is our source -src = [] -add_files(src, os.walk("zanthor")) -src.extend(glob.glob("*.py")) - - -# build the sdist target -if cmd not in "py2exe py2app cx_freeze".split(): - f = open("MANIFEST.in", "w") - for l in data: - f.write("include " + l + "\n") - for l in src: - f.write("include " + l + "\n") - f.close() - - setup(**PACKAGEDATA) +) diff --git a/zanthor/__main__.py b/zanthor/__main__.py new file mode 100644 index 0000000..3360ee1 --- /dev/null +++ b/zanthor/__main__.py @@ -0,0 +1,3 @@ +if __name__ == "__main__": + import zanthor.main + zanthor.main.main()