cx_Freeze_fixes_shadow / cxfreeze-postinstall

# cxfreeze-postinstall
#   Script run after installation on Windows to fix up the Python location in
# the script as well as create batch files.

import distutils.sysconfig
import glob
import os

vars = distutils.sysconfig.get_config_vars()
prefix = vars["prefix"]
python = os.path.join(prefix, "python.exe")
scriptDir = os.path.join(prefix, "Scripts")
for fileName in glob.glob(os.path.join(scriptDir, "cxfreeze*")):

    # skip already created batch files if they exist
    name, ext = os.path.splitext(os.path.basename(fileName))
    if name == "cxfreeze-postinstall" or ext:

    # copy the file with the first line replaced with the correct python
    fullName = os.path.join(scriptDir, fileName)
    lines = open(fullName).readlines()
    outFile = open(fullName, "w")
    outFile.write("#!%s\n" % python)

    # create the batch file
    batchFileName = fullName + ".bat"
    command = "%s %s %%*" % (python, fullName)
    open(batchFileName, "w").write("@echo off\n\n%s" % command)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.