From befeb39dab79abf0803367c30addc0137fad2b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 27 Apr 2024 21:17:41 +0200 Subject: [PATCH 1/4] setup: 1.2.4a1 and set the url as zanthor github --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2252678..9d95a6c 100755 --- a/setup.py +++ b/setup.py @@ -5,12 +5,12 @@ METADATA = { "name": APP_NAME, - "version": "1.2.3", + "version": "1.2.4a1", "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/", + "url": "http://github.com/pygame/zanthor/", "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: End Users/Desktop", From 596c603295d51aad20fb493ab3e4bc5c1ee62538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 27 Apr 2024 21:18:00 +0200 Subject: [PATCH 2/4] github: Add a python-publish workflow for releasing to pypi --- .github/workflows/python-publish.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/python-publish.yml 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 }} From e7b760e141450abc830d59a0e67e479deae595d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 27 Apr 2024 21:47:28 +0200 Subject: [PATCH 3/4] zanthor: Add __main__.py so running as a package works Now can run the game like: python -m zanthor --- zanthor/__main__.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 zanthor/__main__.py 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() From 38c9e822e1da9c3ebdbd00bc2fb246fe633430a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Dudfield?= Date: Sat, 27 Apr 2024 21:48:28 +0200 Subject: [PATCH 4/4] setup: Modernize the setup.py and add a MANIFEST.in --- MANIFEST.in | 3 ++ setup.py | 134 ++++++++++------------------------------------------ 2 files changed, 29 insertions(+), 108 deletions(-) create mode 100644 MANIFEST.in 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 9d95a6c..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.4a1", - "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://github.com/pygame/zanthor/", - "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) +)