# HG changeset patch # User Thibaut Girka # Date 1323973451 -3600 # Node ID 091301805ccedbd7ae19400db6ed8db43d146665 # Parent 9634eefd2063fec1d9d35689e4be59dab1ab1a05 Move “eclviewer.py” to “eosd” and get rid of run-time depency on Cython. diff --git a/eclviewer.py b/eosd rename from eclviewer.py rename to eosd diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -3,6 +3,9 @@ import os, sys from distutils.core import setup from distutils.extension import Extension +from distutils.command.build_scripts import build_scripts +from distutils.dep_util import newer +from distutils import log # Cython is needed @@ -14,6 +17,22 @@ except ImportError: sys.exit(1) +# The installed script shouldn't call pyximport, strip references to it +class BuildScripts(build_scripts): + def copy_scripts(self): + for script in (os.path.basename(script) for script in self.scripts): + outfile = os.path.join('scripts', script) + if not self.force and not newer(script, outfile): + log.debug("not copying %s (up-to-date)", script) + elif not self.dry_run: + with open(script, 'r') as file, open(outfile, 'w') as out: + for line in file: + if not 'pyximport' in line: + out.write(line) + + orig_build_scripts.copy_scripts(self) + + packages = [] extensions = [] @@ -27,6 +46,7 @@ for directory, _, files in os.walk('pyto [os.path.join(directory, filename)])) + setup(name='PyTouhou', author='Thibaut Girka', author_email='thib@sitedethib.com', @@ -34,6 +54,8 @@ setup(name='PyTouhou', license='GPLv3', packages=packages, ext_modules=extensions, - cmdclass = {'build_ext': build_ext} + scripts=['scripts/eosd'], + cmdclass={'build_ext': build_ext, + 'build_scripts': BuildScripts} )