forked from cournape/Bento
/
bootstrap.py
33 lines (28 loc) · 971 Bytes
/
bootstrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sys
import os
from bento.core \
import \
PackageDescription
from bento.core.utils \
import \
pprint
from bento.commands.script_utils \
import \
create_posix_script, create_win32_script
def install_inplace(pkg):
"""Install scripts of pkg in the current directory."""
for name, executable in pkg.executables.items():
if sys.platform == "win32":
section = create_win32_script(name, executable, ".")
else:
section = create_posix_script(name, executable, ".")
for f in section.files:
os.chmod(f, 0755)
installed = ",".join(section.files)
pprint("GREEN", "installing %s in current directory" % installed)
if __name__ == "__main__":
from setup_common import generate_version_py
generate_version_py("bento/__dev_version.py")
pkg = PackageDescription.from_file("bento.info")
if pkg.executables:
install_inplace(pkg)