def main(): """Main processing function. """ libastylewx.set_text_color("yellow") print(libastylewx.get_python_version()) os.chdir(libastylewx.get_file_py_directory()) remove_dist_directories() if EXTRACT_ALL: build_windows_distribution() build_linux_distribution() build_mac_distribution() elif os.name == "nt": build_windows_distribution() else: build_linux_distribution() build_mac_distribution()
def main(): """Main processing function. """ libastylewx.set_text_color("yellow") print(libastylewx.get_python_version()) os.chdir(libastylewx.get_file_py_directory()) remove_dist_directories() if EXTRACT_ALL and os.name == "nt": build_windows_distribution() build_linux_distribution() build_mac_distribution() elif os.name == "nt": build_windows_distribution() else: build_linux_distribution() build_mac_distribution()
def call_7zip(dist_base, compressed_file): """Call 7zip to create an archive. arg 1- the directory to compress. arg 2- name of the compressed file. """ exepath = libastylewx.get_7zip_path() compress = [exepath, "a", compressed_file] # check file ending to see if it is a tarball if compressed_file.endswith((".gz", ".bz2")): compress.append("*.tar") # stdout file must have full path since 'cwd' is used in call filename = libastylewx.get_file_py_directory(True) + "compress.txt" outfile = open(filename, 'w') try: subprocess.check_call(compress, cwd=dist_base, stdout=outfile) except subprocess.CalledProcessError as err: libastylewx.system_exit("Bad 7zip return: " + str(err.returncode)) except OSError: libastylewx.system_exit("Cannot find executable: " + compress[0]) outfile.close() os.remove(filename) print(compressed_file + " created")