New submission from shiyao.ma:

The current roundup instance installs scripts with #! 
/path/to/your/python/executable

This lacks much flexibility, so I changed that to #! /usr/bin/env python.


This patch also fixes a minor bug in the scripts.
Namely, the path in "sys.path.insert(1, path)" is relative, which is subjective 
to the os.getcwd().

I changed that to absolute path.

This may more sound like a issue of roundup itself.
But it's never too late to be merged upstream.

----------
assignedto: introom
files: venv.patch
messages: 2955
nosy: ezio.melotti, introom
priority: bug
status: unread
title: Support for virtualenv (and absolute import path in bin)

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue565>
_______________________________________________________
diff --git a/roundup/dist/command/build_scripts.py 
b/roundup/dist/command/build_scripts.py
--- a/roundup/dist/command/build_scripts.py
+++ b/roundup/dist/command/build_scripts.py
@@ -68,7 +68,11 @@
             # TODO? allow command-line option
             pass
         if target == sys.platform:
-            self.python_executable = os.path.normpath(sys.executable)
+            # promote virtualenv
+            if os.name == 'posix':
+                self.python_executable = "/usr/bin/env python"
+            else:
+                self.python_executable = os.path.normpath(sys.executable)
         else:
             self.python_executable = "python"
 
@@ -82,7 +86,8 @@
 
         # tweak python path for installations outside main python library
         if cmdopt.get("install", {}).has_key("prefix"):
-            prefix = os.path.expanduser(cmdopt['install']['prefix'][1])
+            prefix = os.path.abspath(
+                os.path.expanduser(cmdopt['install']['prefix'][1]))
             version = '%d.%d'%sys.version_info[:2]
             self.script_preamble = """
 import sys
diff --git a/scripts/schema_diagram.py b/scripts/schema_diagram.py
--- a/scripts/schema_diagram.py
+++ b/scripts/schema_diagram.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
 #
 # Schema diagram generator contributed by Stefan Seefeld of the fresco
 # project http://www.fresco.org/.
_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss

Reply via email to