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,
initialization, rpsetup)
)
# TODO: integrate distutils_scripts
for name, full_script_path in distutils_scripts:
if scripts is not None:
sname = scripts.get(name)
......@@ -990,6 +989,7 @@ def scripts(reqs, working_set, executable, dest,
return generated
def _relative_path_and_setup(sname, path, relative_paths):
if relative_paths:
relative_paths = os.path.normcase(relative_paths)
......@@ -1019,6 +1019,7 @@ def _relative_depth(common, path):
path = dirname
return n
def _relative_path(common, path):
r = []
while 1:
......@@ -1032,6 +1033,7 @@ def _relative_path(common, path):
r.reverse()
return os.path.join(*r)
def _relativitize(path, script, relative_paths):
if path == script:
raise AssertionError("path == script")
......@@ -1068,7 +1070,12 @@ def _script(module_name, attrs, path, dest, executable, arguments,
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(
python = _safe_arg(executable),
path = path,
......
......@@ -935,7 +935,15 @@ python interpreter. Buildout does the same, but additionally also adds the
sys.path like for the console_scripts:
>>> 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
......
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