Commit 5c3b1e8d authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

obs/re6st: fix bootstrap script

Fixup b3ecd384i (obs/_generic: support bootstrapping with either python2 or python3)

The symbolic link is not suported by re6st compilation (it is totally
removed from the archive)
parent 310dfc21
../_generic/compilation/makefile-scripts/bootstrap
\ No newline at end of file
#!/usr/bin/python3 -S
import glob, os, shutil, sys, tarfile, tempfile, zipfile
dist = "download-cache/dist"
tmp = tempfile.mkdtemp()
try:
setuptools, = glob.glob(dist + "/setuptools-*")
if setuptools.endswith(".zip"):
zipfile.ZipFile(setuptools).extractall(tmp)
else:
tarfile.TarFile.open(setuptools, "r:*").extractall(tmp)
x, = os.listdir(tmp)
sys.path.insert(0, os.path.join(tmp, x))
from setuptools.command.easy_install import main
for x in "bin", "eggs":
try:
os.mkdir(x)
except OSError:
pass
main(["-f", dist, "-mxd", x, setuptools, "zc.buildout"])
finally:
shutil.rmtree(tmp)
with os.fdopen(os.open("bin/buildout", os.O_CREAT|os.O_WRONLY|os.O_TRUNC, 0o777), 'w') as f:
f.write("""\
#!%s -S
import os, sys
d = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
d = os.path.dirname(d) + %r
sys.path[:0] = (%s)
from zc.buildout.buildout import main
sys.exit(main())
""" % (
sys.executable,
"/%s/" % x,
", ".join(map("d + %r".__mod__, os.listdir(x))),
))
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