Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with PEP 517, move project metadata to pyproject.toml #84

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
language: python
python:
- "2.7"
- "3.6"
- "3.7"
- "3.10"
EpicWink marked this conversation as resolved.
Show resolved Hide resolved

install:
- pip install pygame numpy cython pytest psutil
Expand Down
30 changes: 30 additions & 0 deletions accelerate/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[build-system]
requires = [ "setuptools >= 61.0", "Cython >= 0.28", "numpy" ]
EpicWink marked this conversation as resolved.
Show resolved Hide resolved
build-backend = "setuptools.build_meta"

[project]
name = "PyOpenGL-accelerate"
description = "Acceleration code for PyOpenGL"
authors = [ { name = "Mike C. Fletcher", email = "[email protected]" } ]
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__" }
Empty file removed accelerate/requirements.txt
Empty file.
49 changes: 6 additions & 43 deletions accelerate/setup.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 = [
]
Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand All @@ -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 = "[email protected]",
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
)
33 changes: 5 additions & 28 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -85,15 +61,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 -m pip install ."
- cd accelerate
- "%CMD_IN_ENV% %PYTHON%\\python.exe setup.py install"
- "%CMD_IN_ENV% %PYTHON%\\python.exe -m 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:
Expand Down
8 changes: 5 additions & 3 deletions appveyor/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
& $python_path -m pip install --upgrade pip
}
}

Expand Down Expand Up @@ -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..."
& $conda_path update --yes pip
}
}

Expand All @@ -229,7 +231,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
40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[build-system]
requires = [ "setuptools >= 61.0" ]
build-backend = "setuptools.build_meta"

[project]
name = "PyOpenGL"
description = "Standard OpenGL bindings for Python"
authors = [ { name = "Mike C. Fletcher", email = "[email protected]" } ]
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__" }
6 changes: 3 additions & 3 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
49 changes: 1 addition & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]',
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):
Expand Down Expand Up @@ -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'],
Expand All @@ -88,5 +42,4 @@ def run(self):
},
data_files = datafiles,
cmdclass = extra_commands,
**metadata
)
9 changes: 4 additions & 5 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down