Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Have setuptools generate .exe wrappers for scripts on Windows

  • Loading branch information...
commit e658b4ba82c5c07d40d2a5e394f42ecdac82b8fb 1 parent 53144ff
@abbeyj abbeyj authored
View
8 SetupConfig.py
@@ -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
4 bin/cheetah
@@ -1,3 +1,3 @@
#!/usr/bin/env python
-from Cheetah.CheetahWrapper import CheetahWrapper
-CheetahWrapper().main()
+from Cheetah.CheetahWrapper import _cheetah
+_cheetah()
View
6 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()
View
10 cheetah/CheetahWrapper.py
@@ -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()
Please sign in to comment.
Something went wrong with that request. Please try again.