comparison 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
comparison
equal deleted inserted replaced
217:577f45454402 218:9634eefd2063
1 # -*- encoding: utf-8 -*- 1 # -*- encoding: utf-8 -*-
2 2
3 import os, sys 3 import os, sys
4 #import shutil
5 from distutils.core import setup 4 from distutils.core import setup
6 from distutils.extension import Extension 5 from distutils.extension import Extension
7 6
7
8 # Cython is needed
8 try: 9 try:
9 from Cython.Distutils import build_ext 10 from Cython.Distutils import build_ext
10 except ImportError: 11 except ImportError:
11 print('You don’t seem to have Cython installed. Please get a ' 12 print('You don’t seem to have Cython installed. Please get a '
12 'copy from www.cython.org and install it') 13 'copy from www.cython.org and install it')
13 sys.exit(1) 14 sys.exit(1)
15
14 16
15 packages = [] 17 packages = []
16 extensions = [] 18 extensions = []
17 19
18 for directory, _, files in os.walk('pytouhou'): 20 for directory, _, files in os.walk('pytouhou'):
19 package = directory.replace(os.path.sep, '.') 21 package = directory.replace(os.path.sep, '.')
20 packages.append(package) 22 packages.append(package)
21 for filename in files: 23 for filename in files:
22 if filename.endswith('.pyx'): 24 if filename.endswith('.pyx'):
23 extensions.append(Extension('%s.%s' % (package, filename[:-4]), 25 extension_name = '%s.%s' % (package, os.path.splitext(filename)[0])
24 ['%s/%s' % (directory, filename)])) 26 extensions.append(Extension(extension_name,
27 [os.path.join(directory, filename)]))
25 28
26 #TODO: put eclviewer.py in /usr/bin/ the right way
27 #shutil.copyfile('eclviewer.py', 'pytouhou/pytouhou')
28 29
29 setup(name='PyTouhou', 30 setup(name='PyTouhou',
31 author='Thibaut Girka',
32 author_email='thib@sitedethib.com',
33 url='http://hg.sitedethib.com/touhou/',
34 license='GPLv3',
30 packages=packages, 35 packages=packages,
31 ext_modules=extensions, 36 ext_modules=extensions,
32 #scripts=['pytouhou/pytouhou'], 37 cmdclass = {'build_ext': build_ext}
33 cmdclass = {'build_ext': build_ext}) 38 )
39