Commit dc84fc82 authored by Reinout van Rees's avatar Reinout van Rees

Got correct script to be written

parent 34eeaf23
...@@ -966,7 +966,6 @@ def scripts(reqs, working_set, executable, dest, ...@@ -966,7 +966,6 @@ def scripts(reqs, working_set, executable, dest,
initialization, rpsetup) initialization, rpsetup)
) )
# TODO: integrate distutils_scripts
for name, full_script_path in distutils_scripts: for name, full_script_path in distutils_scripts:
if scripts is not None: if scripts is not None:
sname = scripts.get(name) sname = scripts.get(name)
...@@ -990,6 +989,7 @@ def scripts(reqs, working_set, executable, dest, ...@@ -990,6 +989,7 @@ def scripts(reqs, working_set, executable, dest,
return generated return generated
def _relative_path_and_setup(sname, path, relative_paths): def _relative_path_and_setup(sname, path, relative_paths):
if relative_paths: if relative_paths:
relative_paths = os.path.normcase(relative_paths) relative_paths = os.path.normcase(relative_paths)
...@@ -1019,6 +1019,7 @@ def _relative_depth(common, path): ...@@ -1019,6 +1019,7 @@ def _relative_depth(common, path):
path = dirname path = dirname
return n return n
def _relative_path(common, path): def _relative_path(common, path):
r = [] r = []
while 1: while 1:
...@@ -1032,6 +1033,7 @@ def _relative_path(common, path): ...@@ -1032,6 +1033,7 @@ def _relative_path(common, path):
r.reverse() r.reverse()
return os.path.join(*r) return os.path.join(*r)
def _relativitize(path, script, relative_paths): def _relativitize(path, script, relative_paths):
if path == script: if path == script:
raise AssertionError("path == script") raise AssertionError("path == script")
...@@ -1068,7 +1070,12 @@ def _script(module_name, attrs, path, dest, executable, arguments, ...@@ -1068,7 +1070,12 @@ def _script(module_name, attrs, path, dest, executable, arguments,
def _distutils_script(path, dest, original_file, executable, initialization, rsetup): def _distutils_script(path, dest, original_file, executable, initialization, rsetup):
original_content = "TODO, strip first line from original_file" lines = open(original_file).readlines()
if not ('#!' in lines[0]) and ('python' in lines[0]):
# The script doesn't follow distutil's rules. Ignore it.
return []
original_content = ''.join(lines[1:])
# TODO: does this work OK with non-ascii characters?
contents = distutils_script_template % dict( contents = distutils_script_template % dict(
python = _safe_arg(executable), python = _safe_arg(executable),
path = path, path = path,
......
...@@ -935,7 +935,15 @@ python interpreter. Buildout does the same, but additionally also adds the ...@@ -935,7 +935,15 @@ python interpreter. Buildout does the same, but additionally also adds the
sys.path like for the console_scripts: sys.path like for the console_scripts:
>>> cat(distbin, 'distutilsscript') >>> cat(distbin, 'distutilsscript')
TODO #!/usr/local/bin/python2.4
<BLANKLINE>
import sys
sys.path[0:0] = [
'/distutilsscriptdir/other-1.0-pyN.N.egg',
]
<BLANKLINE>
<BLANKLINE>
print "distutils!"
Handling custom build options for extensions provided in source distributions Handling custom build options for extensions provided in source distributions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment