Mercurial > touhou
annotate setup.py @ 218:9634eefd2063
Minor changes to the setup script
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Mon, 05 Dec 2011 23:57:58 +0100 |
parents | 9bdf116bb2a5 |
children | 091301805cce |
rev | line source |
---|---|
213
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 import os, sys |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 from distutils.core import setup |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 from distutils.extension import Extension |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 |
218
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
7 |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
8 # Cython is needed |
213
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 try: |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 from Cython.Distutils import build_ext |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 except ImportError: |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 print('You don’t seem to have Cython installed. Please get a ' |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 'copy from www.cython.org and install it') |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 sys.exit(1) |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 |
218
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
16 |
213
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 packages = [] |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 extensions = [] |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 for directory, _, files in os.walk('pytouhou'): |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 package = directory.replace(os.path.sep, '.') |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 packages.append(package) |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 for filename in files: |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
24 if filename.endswith('.pyx'): |
218
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
25 extension_name = '%s.%s' % (package, os.path.splitext(filename)[0]) |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
26 extensions.append(Extension(extension_name, |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
27 [os.path.join(directory, filename)])) |
213
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 setup(name='PyTouhou', |
218
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
31 author='Thibaut Girka', |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
32 author_email='thib@sitedethib.com', |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
33 url='http://hg.sitedethib.com/touhou/', |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
34 license='GPLv3', |
213
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 packages=packages, |
9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 ext_modules=extensions, |
218
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
37 cmdclass = {'build_ext': build_ext} |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
38 ) |
9634eefd2063
Minor changes to the setup script
Thibaut Girka <thib@sitedethib.com>
parents:
213
diff
changeset
|
39 |