diff options
author | James Abbatiello <abbeyj@gmail.com> | 2009-08-04 14:36:49 -0400 |
---|---|---|
committer | James Abbatiello <abbeyj@gmail.com> | 2009-08-04 14:36:49 -0400 |
commit | e658b4ba82c5c07d40d2a5e394f42ecdac82b8fb (patch) | |
tree | a765c292c9cb4318b302f5c8f68db4fcf97efea4 | |
parent | 53144fffd7754476b8b866b7b52fa9faab1548e4 (diff) | |
download | python-cheetah-e658b4ba82c5c07d40d2a5e394f42ecdac82b8fb.tar.gz |
Have setuptools generate .exe wrappers for scripts on Windows
-rw-r--r-- | SetupConfig.py | 8 | ||||
-rwxr-xr-x | bin/cheetah | 4 | ||||
-rw-r--r-- | bin/cheetah-compile | 6 | ||||
-rw-r--r-- | cheetah/CheetahWrapper.py | 10 |
4 files changed, 22 insertions, 6 deletions
diff --git a/SetupConfig.py b/SetupConfig.py index 4ac7108..d974418 100644 --- a/SetupConfig.py +++ b/SetupConfig.py @@ -57,6 +57,14 @@ if not os.getenv('CHEETAH_INSTALL_WITHOUT_SETUPTOOLS'): install_requires = [ "Markdown >= 2.0.1", ] + # use 'entry_points' instead of 'scripts' + del scripts + entry_points = { + 'console_scripts': [ + 'cheetah = Cheetah.CheetahWrapper:_cheetah', + 'cheetah-compile = Cheetah.CheetahWrapper:_cheetah_compile', + ] + } except ImportError: print 'Not using setuptools, so we cannot install the Markdown dependency' diff --git a/bin/cheetah b/bin/cheetah index 26c391a..61b8178 100755 --- a/bin/cheetah +++ b/bin/cheetah @@ -1,3 +1,3 @@ #!/usr/bin/env python -from Cheetah.CheetahWrapper import CheetahWrapper -CheetahWrapper().main() +from Cheetah.CheetahWrapper import _cheetah +_cheetah() diff --git a/bin/cheetah-compile b/bin/cheetah-compile index 5d9ab60..f15528e 100644 --- a/bin/cheetah-compile +++ b/bin/cheetah-compile @@ -1,5 +1,3 @@ #!/usr/bin/env python -import sys -from Cheetah.CheetahWrapper import CheetahWrapper -sys.argv.insert(1, "compile") -CheetahWrapper().main() +from Cheetah.CheetahWrapper import _cheetah_compile +_cheetah_compile() diff --git a/cheetah/CheetahWrapper.py b/cheetah/CheetahWrapper.py index 96f57d5..9af8f1e 100644 --- a/cheetah/CheetahWrapper.py +++ b/cheetah/CheetahWrapper.py @@ -614,6 +614,16 @@ be named according to the same rules as Python modules.""" % tup) f.close() +# Called when invoked as `cheetah` +def _cheetah(): + CheetahWrapper().main() + +# Called when invoked as `cheetah-compile` +def _cheetah_compile(): + sys.argv.insert(1, "compile") + CheetahWrapper().main() + + ################################################## ## if run from the command line if __name__ == '__main__': CheetahWrapper().main() |