def toZipFile(sourceDir, zipDest=None, removeScr=True, isWrapperDirIncluded=False): sourceDir = absPath(sourceDir) if zipDest is None: zipDest = sourceDir # make_archive adds extension else: if isFile(zipDest): removeFile(zipDest) zipDest, _ = splitExt(zipDest) if isWrapperDirIncluded: filePath = make_archive(zipDest, 'zip', dirPath(sourceDir), fileBaseName(sourceDir)) else: filePath = make_archive(zipDest, 'zip', sourceDir) print('Created zip file: "%s"' % (filePath, )) if removeScr: removeDir(sourceDir) print('Removed directory: "%s"' % (sourceDir, )) return filePath
def modulePackagePath(moduleName): modPath = modulePath(moduleName) return None if modPath is None else dirPath(modPath)
import inspect # @UnusedImport from time import sleep from struct import calcsize # ----------------------------------------------------------------------------- __plat = platform.system() IS_WINDOWS = __plat == "Windows" IS_LINUX = __plat == "Linux" IS_MACOS = __plat == "Darwin" BIT_CONTEXT = calcsize('P') * 8 IS_32_BIT_CONTEXT = BIT_CONTEXT == 32 IS_64_BIT_CONTEXT = BIT_CONTEXT == 64 PY_EXT = ".py" PY_DIR = dirPath(PYTHON_PATH) SITE_PACKAGES_PATH = get_python_lib() # (client script's dir) THIS_DIR = dirPath(realpath(argv[0])) __THIS_LIB_DIR = dirPath(realpath(__file__)) PATH_PAIR_DELIMITER = ";" SYS_CMD_DELIM = "&" if IS_WINDOWS else ";" SYS_CMD_COND_DELIM = "&&" # Windows PY_SCRIPTS_DIR = joinPath(PY_DIR, "Scripts") # *Nix