Mercurial > touhou
changeset 213:9bdf116bb2a5
Add a distutils setup and don’t hardcode DAT list.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 27 Nov 2011 15:13:31 +0100 |
parents | 78e9957ad344 |
children | 136d29ffe3c2 |
files | eclviewer.py setup.py |
diffstat | 2 files changed, 37 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/eclviewer.py +++ b/eclviewer.py @@ -27,7 +27,7 @@ from pytouhou.game.player import PlayerS from pytouhou.formats.t6rp import T6RP -def main(path, stage_num, rank, character, replay): +def main(path, stage_num, rank, character, replay, data): if replay: with open(replay, 'rb') as file: replay = T6RP.read(file) @@ -42,7 +42,7 @@ def main(path, stage_num, rank, characte resource_loader = Loader() resource_loader.scan_archives(os.path.join(path, name) - for name in ('CM.DAT', 'ST.DAT')) + for name in data) game = EoSDGame(resource_loader, [PlayerState(character=character)], stage_num, rank, 16, prng=prng) @@ -62,6 +62,7 @@ def main(path, stage_num, rank, characte parser = argparse.ArgumentParser(description='Libre reimplementation of the Touhou 6 engine.') +parser.add_argument('data', metavar='DAT', default=('CM.DAT', 'ST.DAT'), nargs='*', help='Game’s .DAT data files') parser.add_argument('-p', '--path', metavar='DIRECTORY', default='.', help='Game directory path.') parser.add_argument('-s', '--stage', metavar='STAGE', type=int, required=True, help='Stage, 1 to 7 (Extra).') parser.add_argument('-r', '--rank', metavar='RANK', type=int, default=0, help='Rank, from 0 (Easy, default) to 3 (Lunatic).') @@ -70,4 +71,4 @@ parser.add_argument('--replay', metavar= args = parser.parse_args() -main(args.path, args.stage, args.rank, args.character, args.replay) +main(args.path, args.stage, args.rank, args.character, args.replay, tuple(args.data))
new file mode 100644 --- /dev/null +++ b/setup.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- + +import os, sys +#import shutil +from distutils.core import setup +from distutils.extension import Extension + +try: + from Cython.Distutils import build_ext +except ImportError: + print('You don’t seem to have Cython installed. Please get a ' + 'copy from www.cython.org and install it') + sys.exit(1) + +packages = [] +extensions = [] + +for directory, _, files in os.walk('pytouhou'): + package = directory.replace(os.path.sep, '.') + packages.append(package) + for filename in files: + if filename.endswith('.pyx'): + extensions.append(Extension('%s.%s' % (package, filename[:-4]), + ['%s/%s' % (directory, filename)])) + +#TODO: put eclviewer.py in /usr/bin/ the right way +#shutil.copyfile('eclviewer.py', 'pytouhou/pytouhou') + +setup(name='PyTouhou', + packages=packages, + ext_modules=extensions, + #scripts=['pytouhou/pytouhou'], + cmdclass = {'build_ext': build_ext})