Permalink
Browse files

Have setuptools generate .exe wrappers for scripts on Windows

  • Loading branch information...
1 parent 53144ff commit e658b4ba82c5c07d40d2a5e394f42ecdac82b8fb @abbeyj abbeyj committed Aug 4, 2009
Showing with 22 additions and 6 deletions.
  1. +8 −0 SetupConfig.py
  2. +2 −2 bin/cheetah
  3. +2 −4 bin/cheetah-compile
  4. +10 −0 cheetah/CheetahWrapper.py
View
@@ -57,6 +57,14 @@
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'
View
@@ -1,3 +1,3 @@
#!/usr/bin/env python
-from Cheetah.CheetahWrapper import CheetahWrapper
-CheetahWrapper().main()
+from Cheetah.CheetahWrapper import _cheetah
+_cheetah()
View
@@ -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()
View
@@ -614,6 +614,16 @@ def _compileOrFillBundle(self, b):
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()

0 comments on commit e658b4b

Please sign in to comment.