1616# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818#
19- # $Id: setup.py,v 1.49 2003-04-19 05:03:54 richard Exp $
19+ # $Id: setup.py,v 1.50 2003-04-25 02:09:20 richard Exp $
2020
2121from distutils .core import setup , Extension
2222from distutils .util import get_platform
@@ -77,10 +77,21 @@ def copy_scripts(self):
7777
7878 module = os .path .splitext (os .path .basename (script ))[0 ]
7979 module = string .translate (module , to_module )
80+ cmdopt = self .distribution .command_options
81+ if cmdopt ['install' ].has_key ('prefix' ):
82+ prefix = cmdopt ['install' ]['prefix' ][1 ]
83+ version = '%d.%d' % sys .version_info [:2 ]
84+ prefix = '''
85+ import sys
86+ sys.path.insert(1, "%s/lib/python%s/site-packages")
87+ ''' % (prefix , version )
88+ else :
89+ prefix = ''
8090 script_vars = {
8191 'python' : os .path .normpath (sys .executable ),
8292 'package' : self .package_name ,
8393 'module' : module ,
94+ 'prefix' : prefix ,
8495 }
8596
8697 self .announce ("creating %s" % outfile )
@@ -93,7 +104,7 @@ def copy_scripts(self):
93104 'if "%%_4ver%%" == "" "%(python)s" -O -c "from %(package)s.scripts.%(module)s import run; run()" %%*\n '
94105 % script_vars )
95106 else :
96- file .write ('#! %(python)s -O\n '
107+ file .write ('#! %(python)s -O\n %(prefix)s '
97108 'from %(package)s.scripts.%(module)s import run\n '
98109 'run()\n '
99110 % script_vars )
0 commit comments