From 9bbfd8edae19aa9d2bd1a5264b2560da56be5f1d Mon Sep 17 00:00:00 2001 From: Laurie O Date: Wed, 3 Aug 2022 12:20:49 +1000 Subject: [PATCH 1/9] Move project metadata pyproject.toml * Enable PEP 517 builds * Remove download-URL * Remove unused 'ctypes' dependency * Remove empty accelerate requirements file * Remove '..' from accelerate include-dirs --- accelerate/pyproject.toml | 30 +++++++++++++++++++++++ accelerate/requirements.txt | 0 accelerate/setup.py | 49 +++++-------------------------------- appveyor.yml | 9 ++++--- pyproject.toml | 40 ++++++++++++++++++++++++++++++ readme.rst | 6 ++--- setup.py | 49 +------------------------------------ tests/tests.py | 9 +++---- 8 files changed, 89 insertions(+), 103 deletions(-) create mode 100644 accelerate/pyproject.toml delete mode 100644 accelerate/requirements.txt create mode 100644 pyproject.toml diff --git a/accelerate/pyproject.toml b/accelerate/pyproject.toml new file mode 100644 index 00000000..f9690e07 --- /dev/null +++ b/accelerate/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = [ "setuptools", "Cython >= 0.28", "numpy" ] +build-backend = "setuptools.build_meta" + +[project] +name = "PyOpenGL-accelerate" +description = "Acceleration code for PyOpenGL" +authors = [ { name = "Mike C. Fletcher", email = "mcfletch@vrplumber.com" } ] +urls.homepage = "http://pyopengl.sourceforge.net" +license = { text = "BSD" } +readme = { file = "README.txt", content-type = "text/plain" } +keywords = [ "PyOpenGL", "accelerate", "Cython" ] +classifiers = [ + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: C", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Multimedia :: Graphics :: 3D Rendering", + "Intended Audience :: Developers", +] + +dynamic = [ "version" ] + +[tool.setuptools] +packages = [ "OpenGL_accelerate" ] +platforms = [ "Win32", "Linux", "OS-X", "Posix" ] + +[tool.setuptools.dynamic] +version = { attr = "OpenGL_accelerate.__init__.__version__" } diff --git a/accelerate/requirements.txt b/accelerate/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/accelerate/setup.py b/accelerate/setup.py index ef973958..961aa599 100644 --- a/accelerate/setup.py +++ b/accelerate/setup.py @@ -1,10 +1,9 @@ #!/usr/bin/env python """Builds accelleration functions for PyOpenGL """ -try: - from setuptools import setup,Extension -except ImportError: - from distutils.core import setup,Extension + +from setuptools import setup, Extension + try: from Cython.Distutils import build_ext except ImportError: @@ -15,15 +14,6 @@ import sys, os HERE = os.path.normpath(os.path.abspath(os.path.dirname( __file__ ))) -with open(os.path.join(HERE, 'README.txt'), 'r') as f: - long_description = f.read() - -version = None -# get version from __init__.py -for line in open( os.path.join( HERE,'OpenGL_accelerate','__init__.py') ): - if line.startswith( '__version__' ): - version = eval(line.split( '=' )[1].strip()) -assert version, """Couldn't determine version string!""" extensions = [ ] @@ -41,7 +31,6 @@ def cython_extension( name, include_dirs = (), ): ), ], include_dirs = [ - os.path.join(HERE,'..'), os.path.join(HERE,'src'), HERE, ]+ list(include_dirs), @@ -92,7 +81,7 @@ def cython_extension( name, include_dirs = (), ): ) ) -if __name__ == "__main__": +if True: # minimise Git diff # Workaround for Broken apple Python build params echoed in distutils # Approach taken from the PyMongo driver. OS-X Python builds were created with # non-existent flag, and distutils passes those flags to the extension @@ -104,46 +93,20 @@ def cython_extension( name, include_dirs = (), ): for key in ('CFLAGS', 'PY_CFLAGS'): if key in res: res[key] = res[key].replace('-mno-fused-madd', '') - - extraArguments = { - 'classifiers': [ - """License :: OSI Approved :: BSD License""", - """Programming Language :: Python""", - """Programming Language :: Python :: 3""", - """Programming Language :: C""", - """Topic :: Software Development :: Libraries :: Python Modules""", - """Topic :: Multimedia :: Graphics :: 3D Rendering""", - """Intended Audience :: Developers""", - ], - 'keywords': 'PyOpenGL,accelerate,Cython', - 'long_description' : long_description, - 'long_description_content_type' : 'text/plain', - 'platforms': ['Win32','Linux','OS-X','Posix'], - } + + extraArguments = {} ### Now the actual set up call if have_cython: extraArguments['cmdclass'] = { 'build_ext': build_ext, } setup ( - name = "PyOpenGL-accelerate", - version = version, - description = "Acceleration code for PyOpenGL", - author = "Mike C. Fletcher", - author_email = "mcfletch@vrplumber.com", - url = "http://pyopengl.sourceforge.net", - download_url = "http://sourceforge.net/project/showfiles.php?group_id=5988", - license = 'BSD', - packages = ['OpenGL_accelerate'], options = { 'sdist': { 'formats': ['gztar','zip'], 'force_manifest': True, }, }, - package_dir = { - 'OpenGL_accelerate':'OpenGL_accelerate', - }, ext_modules=extensions, **extraArguments ) diff --git a/appveyor.yml b/appveyor.yml index 8374dec7..c3e53eee 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -85,15 +85,16 @@ init: install: - "powershell appveyor\\install.ps1" - "%CMD_IN_ENV% %PYTHON%\\python.exe -m pip install --prefer-binary pygame pytest numpy" - - "%CMD_IN_ENV% %PYTHON%\\python.exe setup.py install" + - "%CMD_IN_ENV% %PYTHON%\\python.exe pip install ." - cd accelerate - - "%CMD_IN_ENV% %PYTHON%\\python.exe setup.py install" + - "%CMD_IN_ENV% %PYTHON%\\python.exe pip install ." - cd .. build_script: - cd accelerate - - "ECHO %WITH_COMPILER% %PYTHON%/python.exe setup.py bdist_wheel" - - "%WITH_COMPILER% %PYTHON%/python.exe setup.py bdist_wheel" + - "%PYTHON%\\python.exe -m pip install build" + - "ECHO %WITH_COMPILER% %PYTHON%/python.exe -m build ." + - "%WITH_COMPILER% %PYTHON%/python.exe -m build ." - cd .. test_script: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..c9ecf294 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = [ "setuptools" ] +build-backend = "setuptools.build_meta" + +[project] +name = "PyOpenGL" +description = "Standard OpenGL bindings for Python" +authors = [ { name = "Mike C. Fletcher", email = "mcfletch@vrplumber.com" } ] +urls.homepage = "http://pyopengl.sourceforge.net" +license = { text = "BSD" } +readme = "readme.rst" +keywords = [ + "Graphics", + "3D", + "OpenGL", + "GLU", + "GLUT", + "GLE", + "GLX", + "EXT", + "ARB", + "Mesa", + "ctypes", +] +classifiers = [ + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Multimedia :: Graphics :: 3D Rendering", + "Topic :: Software Development :: Libraries :: Python Modules", + "Intended Audience :: Developers", +] + +dynamic = [ "version" ] + +[tool.setuptools.packages] +find = { include = [ "OpenGL*" ], namespaces = false } + +[tool.setuptools.dynamic] +version = { attr = "OpenGL.version.__version__" } diff --git a/readme.rst b/readme.rst index 9503ac1f..d26e1c9e 100644 --- a/readme.rst +++ b/readme.rst @@ -6,12 +6,12 @@ PyOpenGL is normally distributed via PyPI using standard pip:: $ pip install PyOpenGL PyOpenGL_accelerate You can install this repository by branching/cloning and running -setup.py:: +``pip``:: $ cd pyopengl - $ python setup.py develop + $ pip install -e . $ cd accelerate - $ python setup.py develop + $ pip install -e . Note that to compile PyOpenGL_accelerate you will need to have a functioning Python extension-compiling environment. diff --git a/setup.py b/setup.py index 741482bf..bf7a94a0 100644 --- a/setup.py +++ b/setup.py @@ -3,51 +3,8 @@ """ import sys, os extra_commands = {} -try: - from setuptools import setup -except ImportError: - from distutils.core import setup -HERE = os.path.normpath(os.path.abspath(os.path.dirname( __file__ ))) -with open(os.path.join(HERE, 'readme.rst'), 'r') as f: - long_description = f.read() - -sys.path.insert(0, '.' ) -metadata = dict( - version = [ - (line.split('=')[1]).strip().strip('"').strip("'") - for line in open(os.path.join('OpenGL','version.py')) - if line.startswith( '__version__' ) - ][0], - author = 'Mike C. Fletcher', - author_email = 'mcfletch@vrplumber.com', - url = 'http://pyopengl.sourceforge.net', - license = 'BSD', - download_url = "http://sourceforge.net/projects/pyopengl/files/PyOpenGL/", - keywords = 'Graphics,3D,OpenGL,GLU,GLUT,GLE,GLX,EXT,ARB,Mesa,ctypes', - classifiers = [ - """License :: OSI Approved :: BSD License""", - """Programming Language :: Python""", - """Programming Language :: Python :: 3""", - """Topic :: Multimedia :: Graphics :: 3D Rendering""", - """Topic :: Software Development :: Libraries :: Python Modules""", - """Intended Audience :: Developers""", - ], - long_description = long_description, - long_description_content_type = 'text/x-rst', -) - -def is_package( path ): - return os.path.isfile( os.path.join( path, '__init__.py' )) -def find_packages( root ): - """Find all packages under this directory""" - for path, directories, files in os.walk( root ): - if is_package( path ): - yield path.replace( '/','.' ) - -requirements = [] -if sys.hexversion < 0x2050000: - requirements.append( 'ctypes' ) +from setuptools import setup from distutils.command.install_data import install_data class smart_install_data(install_data): @@ -77,9 +34,6 @@ def run(self): if __name__ == "__main__": setup( - name = "PyOpenGL", - packages = list( find_packages('OpenGL') ), - description = 'Standard OpenGL bindings for Python', options = { 'sdist': { 'formats': ['gztar'], @@ -88,5 +42,4 @@ def run(self): }, data_files = datafiles, cmdclass = extra_commands, - **metadata ) diff --git a/tests/tests.py b/tests/tests.py index 9810d5d1..7251b686 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -139,14 +139,13 @@ def ensure_virtualenv( python, numpy=True ): subprocess.check_call([ os.path.join( bin_path, 'python' ), - 'setup.py', - 'build_ext', '--force', - 'install', + '-m', 'pip', 'install', + '.', ], cwd = os.path.join( HERE, '..','OpenGL_accelerate' )) subprocess.check_call([ os.path.join( bin_path, 'python' ), - 'setup.py', - 'develop', + '-m', 'pip', 'install', + '-e', '.', ], cwd = os.path.join( HERE, '..' )) def env_setup(): From 4092111bfd22160c28185608f685c8c74160e82d Mon Sep 17 00:00:00 2001 From: Laurie O Date: Wed, 3 Aug 2022 12:48:14 +1000 Subject: [PATCH 2/9] Fix package-install in AppVeyor --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c3e53eee..f2f43858 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -85,9 +85,9 @@ init: install: - "powershell appveyor\\install.ps1" - "%CMD_IN_ENV% %PYTHON%\\python.exe -m pip install --prefer-binary pygame pytest numpy" - - "%CMD_IN_ENV% %PYTHON%\\python.exe pip install ." + - "%CMD_IN_ENV% %PYTHON%\\python.exe -m pip install ." - cd accelerate - - "%CMD_IN_ENV% %PYTHON%\\python.exe pip install ." + - "%CMD_IN_ENV% %PYTHON%\\python.exe -m pip install ." - cd .. build_script: From ba8915d4b91dc0de61d4095fadd5de9e579840ba Mon Sep 17 00:00:00 2001 From: Laurie O Date: Thu, 4 Aug 2022 10:26:12 +1000 Subject: [PATCH 3/9] Skip explicit build dependency install in AppVeyor These are ignored anyway, as the build is in an isolated environment --- appveyor/install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 index 010a9b9d..505bd404 100644 --- a/appveyor/install.ps1 +++ b/appveyor/install.ps1 @@ -229,7 +229,7 @@ function InstallPackage ($python_home, $pkg) { function main () { InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON InstallPip $env:PYTHON - InstallPackage $env:PYTHON wheel numpy pygame + InstallPackage $env:PYTHON wheel } main From 126a45c35135494c6798ae0dda53861e99b91d32 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Thu, 4 Aug 2022 10:28:21 +1000 Subject: [PATCH 4/9] Upgrade pip if found in AppVeyor Hopefully will fix TOML parsing errors --- appveyor/install.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 index 505bd404..f99857f2 100644 --- a/appveyor/install.ps1 +++ b/appveyor/install.ps1 @@ -164,7 +164,8 @@ function InstallPip ($python_home) { Write-Host "Executing:" $python_path $GET_PIP_PATH & $python_path $GET_PIP_PATH } else { - Write-Host "pip already installed." + Write-Host "pip already installed. Upgrading..." + & $pip_path install --upgrade pip } } @@ -217,7 +218,8 @@ function InstallMinicondaPip ($python_home) { Write-Host $conda_path $args Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru } else { - Write-Host "pip already installed." + Write-Host "pip already installed. Upgrading..." + & $pip_path install --upgrade pip } } From 0518cf0dbcf7d80f25edd55814f5641a67b009eb Mon Sep 17 00:00:00 2001 From: Laurie O Date: Thu, 4 Aug 2022 10:54:23 +1000 Subject: [PATCH 5/9] Update using environment Python --- appveyor/install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 index f99857f2..c92f0503 100644 --- a/appveyor/install.ps1 +++ b/appveyor/install.ps1 @@ -165,7 +165,7 @@ function InstallPip ($python_home) { & $python_path $GET_PIP_PATH } else { Write-Host "pip already installed. Upgrading..." - & $pip_path install --upgrade pip + & $python_path -m pip install --upgrade pip } } @@ -219,7 +219,7 @@ function InstallMinicondaPip ($python_home) { Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru } else { Write-Host "pip already installed. Upgrading..." - & $pip_path install --upgrade pip + & $conda_path update --yes pip } } From 79a8acbe086e06a6d87ef401e174e67eb99f7278 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Thu, 4 Aug 2022 11:34:14 +1000 Subject: [PATCH 6/9] Require setuptools v61 Earliest version with pyproject.toml support --- accelerate/pyproject.toml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accelerate/pyproject.toml b/accelerate/pyproject.toml index f9690e07..1f43f238 100644 --- a/accelerate/pyproject.toml +++ b/accelerate/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = [ "setuptools", "Cython >= 0.28", "numpy" ] +requires = [ "setuptools >= 61.0", "Cython >= 0.28", "numpy" ] build-backend = "setuptools.build_meta" [project] diff --git a/pyproject.toml b/pyproject.toml index c9ecf294..21030495 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = [ "setuptools" ] +requires = [ "setuptools >= 61.0" ] build-backend = "setuptools.build_meta" [project] From 332482928db5bddb1355817c3ca495166b281951 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Thu, 4 Aug 2022 11:48:23 +1000 Subject: [PATCH 7/9] Drop Python < 3.7 CI testing --- .travis.yml | 3 +-- appveyor.yml | 24 ------------------------ 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 629b7f3f..1da54e70 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,7 @@ language: python python: - - "2.7" - - "3.6" - "3.7" + - "3.10" install: - pip install pygame numpy cython pytest psutil diff --git a/appveyor.yml b/appveyor.yml index f2f43858..ee4a89df 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -35,14 +35,6 @@ environment: # Older Python's that can be built with the default windows images... - - PYTHON: "C:\\Python36" - PYTHON_VERSION: "3.6.4" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6.4" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python37" PYTHON_VERSION: "3.7.0" PYTHON_ARCH: "32" @@ -59,22 +51,6 @@ environment: PYTHON_VERSION: "3.8.0" PYTHON_ARCH: "64" - - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7.14" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python27-x64" - PYTHON_VERSION: "2.7.14" - PYTHON_ARCH: "64" - - - PYTHON: "C:\\Python35" - PYTHON_VERSION: "3.5.3" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python35-x64" - PYTHON_VERSION: "3.5.3" - PYTHON_ARCH: "64" - branches: only: - master From c4f7cd0bd262ef3a09a2c5f008a0e2442063e81f Mon Sep 17 00:00:00 2001 From: Laurie O Date: Tue, 23 Aug 2022 11:29:05 +1000 Subject: [PATCH 8/9] Remove Python 3.10 test in Travis CI --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1da54e70..cc1859f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python python: - "3.7" - - "3.10" install: - pip install pygame numpy cython pytest psutil From 9cbf1fe07e4242a80b9a291af122e082f6053367 Mon Sep 17 00:00:00 2001 From: Laurie O Date: Tue, 23 May 2023 14:20:02 +1000 Subject: [PATCH 9/9] Remove superceded setuptools config files --- accelerate/setup.cfg | 24 ------------------------ setup.cfg | 26 -------------------------- 2 files changed, 50 deletions(-) delete mode 100644 accelerate/setup.cfg delete mode 100644 setup.cfg diff --git a/accelerate/setup.cfg b/accelerate/setup.cfg deleted file mode 100644 index d42986bd..00000000 --- a/accelerate/setup.cfg +++ /dev/null @@ -1,24 +0,0 @@ -[metadata] -name = PyOpenGL-accelerate -version = attr: OpenGL_accelerate.__init__.__version__ -description = Acceleration code for PyOpenGL -author = Mike C. Fletcher -author_email = mcfletch@vrplumber.com -url = http://pyopengl.sourceforge.net -download_url = http://sourceforge.net/project/showfiles.php?group_id=5988 -license = BSD -long_description = file: readme.txt -long_description_content_type = text/plain -keywords = PyOpenGL, accelerate, Cython -platforms = Win32, Linux, OS-X, Posix -classifiers = - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: C - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Multimedia :: Graphics :: 3D Rendering - Intended Audience :: Developers - -[options] -packages = OpenGL_accelerate diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6fe3e154..00000000 --- a/setup.cfg +++ /dev/null @@ -1,26 +0,0 @@ -[metadata] -name = PyOpenGL -version = attr: OpenGL.version.__version__ -description = Standard OpenGL bindings for Python -author = Mike C. Fletcher -author_email = mcfletch@vrplumber.com -url = http://pyopengl.sourceforge.net -download_url = https://pypi.org/project/PyOpenGL/ -license = BSD -long_description = file: readme.rst -long_description_content_type = text/x-rst -keywords = Graphics, 3D, OpenGL, GLU, GLUT, GLE, GLX, EXT, ARB, Mesa, ctypes -classifiers = - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 3 - Topic :: Multimedia :: Graphics :: 3D Rendering - Topic :: Software Development :: Libraries :: Python Modules - Intended Audience :: Developers - -[options] -packages = find: - -[options.packages.find] -include = OpenGL*