This repository was archived by the owner on Oct 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Update/fix the build system for Python 3, remove some old/broken/useless code #57
Open
K900
wants to merge
5
commits into
bastienleonard:master
Choose a base branch
from
K900:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,89 +27,61 @@ | |
| # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| # SUCH DAMAGE. | ||
|
|
||
|
|
||
| # When creating a Windows installer, drop the SFML and dependent DLLs | ||
| # in the current folder and they will be included in the installer. | ||
|
|
||
|
|
||
| # Set to False if you don't have Cython installed. The script will | ||
| # then build the extension module from the sf.cpp file, like a regular | ||
| # extension. | ||
| USE_CYTHON = True | ||
|
|
||
|
|
||
| import glob | ||
| import os.path | ||
| import sys | ||
| from distutils.core import setup | ||
| from distutils.extension import Extension | ||
| from distutils.command.build_ext import build_ext | ||
|
|
||
| if USE_CYTHON: | ||
| import Cython.Distutils | ||
|
|
||
| import Cython.Distutils | ||
|
|
||
| def src(path): | ||
| return os.path.join('src', path) | ||
|
|
||
|
|
||
| print >> sys.stderr, ("\nIf the build fails, run patch.py and try again\n" | ||
| "----------------------------------------------\n") | ||
|
|
||
| libs = ['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'] | ||
|
|
||
| if USE_CYTHON: | ||
| ext_modules = [Extension('sfml', [src('sfml.pyx'), src('hacks.cpp')], | ||
| language='c++', | ||
| libraries=libs)] | ||
| if sys.version_info.major > 2: | ||
| cflags = ["-D", "DL_IMPORT(RTYPE)=RTYPE"] | ||
| else: | ||
| ext_modules = [Extension('sfml', [src('sfml.cpp'), src('hacks.cpp')], | ||
| libraries=libs)] | ||
|
|
||
| cflags = [] | ||
|
|
||
| ext_modules = [Extension( | ||
| 'sfml', | ||
| [src('sfml.pyx'), src('hacks.cpp')], | ||
| language='c++', | ||
| libraries=['sfml-graphics', 'sfml-window', 'sfml-audio', 'sfml-system'], | ||
| extra_compile_args=cflags | ||
| )] | ||
|
|
||
| with open('README.md', 'r') as f: | ||
| long_description = f.read() | ||
|
|
||
| kwargs = dict(name='pySFML', | ||
| ext_modules=ext_modules, | ||
| version='0.2.1', | ||
| description='A Python binding for SFML 2', | ||
| long_description=long_description, | ||
| author=u'Bastien Léonard', | ||
| author_email='[email protected]', | ||
| url='https://github.com/bastienleonard/pysfml-cython', | ||
| license='BSD', | ||
| data_files=[ | ||
| ('', glob.glob('*.dll')), | ||
| (os.path.join('lib', 'site-packages', 'pysfml-cython'), | ||
| ['LICENSE.txt', 'SFML-LICENSE.txt'])], | ||
| classifiers=[ | ||
| 'Development Status :: 4 - Beta', | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: BSD License', | ||
| 'Operating System :: OS Independent', | ||
| 'Programming Language :: Cython', | ||
| 'Topic :: Games/Entertainment', | ||
| 'Topic :: Multimedia', | ||
| 'Topic :: Software Development :: Libraries :: Python Modules' | ||
| ]) | ||
|
|
||
|
|
||
| if USE_CYTHON: | ||
| kwargs.update(cmdclass={'build_ext': Cython.Distutils.build_ext}) | ||
| else: | ||
| class CustomBuildExt(build_ext): | ||
| """This class is used to build the Windows binary releases.""" | ||
|
|
||
| def build_extensions(self): | ||
| cc = self.compiler.compiler_type | ||
|
|
||
| if cc == 'mingw32': | ||
| for e in self.extensions: | ||
| # e.extra_compile_args = [] | ||
| e.extra_link_args = ['-static-libgcc', '-static-libstdc++'] | ||
|
|
||
| build_ext.build_extensions(self) | ||
|
|
||
| kwargs.update(cmdclass={'build_ext': CustomBuildExt}) | ||
|
|
||
| setup(**kwargs) | ||
| setup( | ||
| name='pySFML', | ||
| ext_modules=ext_modules, | ||
| version='0.2.1', | ||
| description='A Python binding for SFML 2', | ||
| long_description=long_description, | ||
| author='Bastien Leonard', | ||
| author_email='[email protected]', | ||
| url='https://github.com/bastienleonard/pysfml-cython', | ||
| license='BSD', | ||
| data_files=[ | ||
| ('', glob.glob('*.dll')), | ||
| (os.path.join('lib', 'site-packages', 'pysfml-cython'), ['LICENSE.txt', 'SFML-LICENSE.txt']) | ||
| ], | ||
| classifiers=[ | ||
| 'Development Status :: 4 - Beta', | ||
| 'Intended Audience :: Developers', | ||
| 'License :: OSI Approved :: BSD License', | ||
| 'Operating System :: OS Independent', | ||
| 'Programming Language :: Cython', | ||
| 'Topic :: Games/Entertainment', | ||
| 'Topic :: Multimedia', | ||
| 'Topic :: Software Development :: Libraries :: Python Modules' | ||
| ], | ||
| cmdclass={ | ||
| 'build_ext': Cython.Distutils.build_ext | ||
| } | ||
| ) | ||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DL_IMPORT(RTYPE)=RTYPE in at least Python 2.7 and up, though it's probably better to find the version where it was removed completely and only override from there up.