Skip to content

Commit

Permalink
bundle.py: tabs to spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfish committed Jan 24, 2019
1 parent 148fe58 commit 100b4d8
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,57 @@
import z3

def make_common_options():
"""
Create the pyinstaller command.
"""
"""
Create the pyinstaller command.
"""

# any dynamically-loaded modules have to be explicitly added
included_data = [
( os.path.join(os.path.dirname(angrmanagement.__file__), "resources"), "angrmanagement/resources" ),
( os.path.join(os.path.dirname(cle.__file__), "backends/pe/relocation"), "cle/backends/pe/relocation" ),
( os.path.join(os.path.dirname(cle.__file__), "backends/elf/relocation"), "cle/backends/elf/relocation" ),
( os.path.join(os.path.dirname(angr.__file__), "analyses/identifier/functions"), "angr/analyses/identifier/functions" ),
( os.path.join(os.path.dirname(angr.__file__), "procedures"), "angr/procedures" ),
]
# any dynamically-loaded modules have to be explicitly added
included_data = [
( os.path.join(os.path.dirname(angrmanagement.__file__), "resources"), "angrmanagement/resources" ),
( os.path.join(os.path.dirname(cle.__file__), "backends/pe/relocation"), "cle/backends/pe/relocation" ),
( os.path.join(os.path.dirname(cle.__file__), "backends/elf/relocation"), "cle/backends/elf/relocation" ),
( os.path.join(os.path.dirname(angr.__file__), "analyses/identifier/functions"), "angr/analyses/identifier/functions" ),
( os.path.join(os.path.dirname(angr.__file__), "procedures"), "angr/procedures" ),
]

# dynamically-loaded DLLs have to be explicitly added. We just include the entire lib dir.
included_libs = [
( os.path.join(os.path.dirname(pyvex.__file__), "lib"), "pyvex/lib" ),
( capstone._path, "capstone/lib" ),
( os.path.join(os.path.dirname(z3.__file__), "lib"), "z3/lib" ),
]
# dynamically-loaded DLLs have to be explicitly added. We just include the entire lib dir.
included_libs = [
( os.path.join(os.path.dirname(pyvex.__file__), "lib"), "pyvex/lib" ),
( capstone._path, "capstone/lib" ),
( os.path.join(os.path.dirname(z3.__file__), "lib"), "z3/lib" ),
]

all_mappings = [ (';' if sys.platform.startswith('win') else ':').join(mapping) for mapping in (included_data + included_libs) ]
all_mappings = [ (';' if sys.platform.startswith('win') else ':').join(mapping) for mapping in (included_data + included_libs) ]

# we add onefile to make a single-executable bundle, and include ipython because it's not autodetected for some reason
args = [ "--onefile", "--hidden-import=ipykernel.datapub" ]
for mapping in all_mappings:
args.append("--add-data")
args.append(mapping)
args.append("start.py")
# we add onefile to make a single-executable bundle, and include ipython because it's not autodetected for some reason
args = [ "--onefile", "--hidden-import=ipykernel.datapub" ]
for mapping in all_mappings:
args.append("--add-data")
args.append(mapping)
args.append("start.py")

return args
return args

def make_bundle():
"""
Execute the pyinstaller command.
"""
common_args = make_common_options()
"""
Execute the pyinstaller command.
"""
common_args = make_common_options()

print("")
print("")
if sys.platform.startswith('linux'):
print("CREATING LINUX BUNDLE")
linux_args = [ "pyinstaller" ] + common_args
os.system(" ".join(linux_args))
elif sys.platform.startswith('win') or sys.platform.startswith('darwin'):
print("CREATING %s BUNDLE" % sys.platform)
windows_args = [ "pyinstaller", "-w",
"-i", os.path.join(os.path.dirname(angrmanagement.__file__), "resources", "images", "angr.ico")
] + common_args
os.system(" ".join(windows_args))
else:
print("UNSUPPORTED PLATFORM")
print("")
print("")
if sys.platform.startswith('linux'):
print("CREATING LINUX BUNDLE")
linux_args = [ "pyinstaller" ] + common_args
os.system(" ".join(linux_args))
elif sys.platform.startswith('win') or sys.platform.startswith('darwin'):
print("CREATING %s BUNDLE" % sys.platform)
windows_args = [ "pyinstaller", "-w",
"-i", os.path.join(os.path.dirname(angrmanagement.__file__), "resources", "images", "angr.ico")
] + common_args
os.system(" ".join(windows_args))
else:
print("UNSUPPORTED PLATFORM")


make_bundle()

0 comments on commit 100b4d8

Please sign in to comment.