|
3 | 3 | # NOTICE: This file is subject to the license agreement defined in file 'LICENSE', which is part of
|
4 | 4 | # this source code package.
|
5 | 5 |
|
6 |
| -from setuptools import setup |
7 |
| - |
| 6 | +from setuptools import setup, find_packages |
| 7 | +import os |
8 | 8 | with open('requirements.txt') as f:
|
9 | 9 | requirements = f.read().splitlines()
|
10 | 10 |
|
11 |
| -from setuptools import setup, find_packages |
12 |
| -from mypyc.build import mypycify |
13 |
| - |
14 | 11 | import re
|
15 | 12 | VERSIONFILE="src/kesslergame/_version.py"
|
16 | 13 | verstrline = open(VERSIONFILE, "rt").read()
|
|
21 | 18 | else:
|
22 | 19 | raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
|
23 | 20 |
|
24 |
| -# List of all Python modules to compile with MyPyC |
25 |
| -mypyc_modules = [ |
26 |
| - "src/kesslergame/asteroid.py", |
27 |
| - "src/kesslergame/bullet.py", |
28 |
| - "src/kesslergame/collisions.py", |
29 |
| - "src/kesslergame/controller.py", |
30 |
| - "src/kesslergame/controller_gamepad.py", |
31 |
| - "src/kesslergame/kessler_game.py", |
32 |
| - "src/kesslergame/mines.py", |
33 |
| - "src/kesslergame/scenario.py", |
34 |
| - "src/kesslergame/score.py", |
35 |
| - "src/kesslergame/ship.py", |
36 |
| - "src/kesslergame/team.py", |
37 |
| - "src/kesslergame/graphics/graphics_base.py", |
38 |
| - "src/kesslergame/graphics/graphics_handler.py", |
39 |
| - "src/kesslergame/graphics/graphics_plt.py", |
40 |
| - "src/kesslergame/graphics/graphics_tk.py", |
41 |
| - "src/kesslergame/graphics/graphics_ue.py", |
42 |
| - # Add __init__.py if you have specific initialization code that needs compilation. |
43 |
| - #"src/__init__.py", |
44 |
| - "src/kesslergame/__init__.py", |
45 |
| - "src/kesslergame/graphics/__init__.py", |
46 |
| -] |
47 |
| - |
48 |
| -setup( |
49 |
| - name='KesslerGame', |
50 |
| - version=verstr, |
51 |
| - packages=find_packages(where='src', exclude=['examples', 'src.examples', '*.examples.*', 'examples.*']), |
52 |
| - install_requires=requirements, |
53 |
| - ext_modules=mypycify(mypyc_modules), |
54 |
| - package_data={ |
55 |
| - '': ['*.png'], |
56 |
| - }, |
57 |
| - package_dir={'': 'src'}, |
58 |
| -) |
| 21 | +if not bool(int(os.getenv('KESSLER_SKIP_COMPILE', '0'))): |
| 22 | + from mypyc.build import mypycify |
| 23 | + |
| 24 | + # List of all Python modules to compile with MyPyC |
| 25 | + mypyc_modules = [ |
| 26 | + "src/kesslergame/asteroid.py", |
| 27 | + "src/kesslergame/bullet.py", |
| 28 | + "src/kesslergame/collisions.py", |
| 29 | + "src/kesslergame/controller.py", |
| 30 | + "src/kesslergame/controller_gamepad.py", |
| 31 | + "src/kesslergame/kessler_game.py", |
| 32 | + "src/kesslergame/mines.py", |
| 33 | + "src/kesslergame/scenario.py", |
| 34 | + "src/kesslergame/score.py", |
| 35 | + "src/kesslergame/ship.py", |
| 36 | + "src/kesslergame/team.py", |
| 37 | + "src/kesslergame/graphics/graphics_base.py", |
| 38 | + "src/kesslergame/graphics/graphics_handler.py", |
| 39 | + "src/kesslergame/graphics/graphics_plt.py", |
| 40 | + "src/kesslergame/graphics/graphics_tk.py", |
| 41 | + "src/kesslergame/graphics/graphics_ue.py", |
| 42 | + # Add __init__.py if you have specific initialization code that needs compilation. |
| 43 | + # "src/__init__.py", |
| 44 | + "src/kesslergame/__init__.py", |
| 45 | + "src/kesslergame/graphics/__init__.py", |
| 46 | + ] |
| 47 | + |
| 48 | + setup( |
| 49 | + name='KesslerGame', |
| 50 | + version=verstr, |
| 51 | + packages=find_packages(where='src', exclude=['examples', 'src.examples', '*.examples.*', 'examples.*']), |
| 52 | + install_requires=requirements, |
| 53 | + ext_modules=mypycify(mypyc_modules), |
| 54 | + package_data={ |
| 55 | + '': ['*.png'], |
| 56 | + }, |
| 57 | + package_dir={'': 'src'}, |
| 58 | + ) |
| 59 | +else: |
| 60 | + # This branch doesn't use mypyc compilation |
| 61 | + setup( |
| 62 | + name='KesslerGame', |
| 63 | + version=verstr, |
| 64 | + install_requires=requirements, |
| 65 | + ) |
| 66 | + |
| 67 | + |
59 | 68 |
|
0 commit comments