Esempio n. 1
0
    def __init__(self):
        isWindows = self.getPlatform() == 'Windows'

        if os.environ.has_key("CHANDLERHOME"):
            self.CHANDLERHOME = os.environ["CHANDLERHOME"]
        else:
            self.CHANDLERHOME = os.getcwd()

        try:
            if not "Chandler.py" in os.listdir(self.CHANDLERHOME):
                raise Exception()
        except:
            self.raiseError("CHANDLERHOME is invalid '%s'." % self.CHANDLERHOME)

        if os.environ.has_key("CHANDLERBIN"):
            self.CHANDLERBIN = os.environ["CHANDLERBIN"]
        else:
            self.CHANDLERBIN = self.CHANDLERHOME

        if isWindows and sys.platform == 'cygwin':
            self.CHANDLERHOME = getCommand(['cygpath', '-a', self.CHANDLERHOME])
            self.CHANDLERBIN  = getCommand(['cygpath', '-a', self.CHANDLERBIN])

        if isWindows:
            pyScript = 'RunPython.bat'
        else:
            pyScript = 'RunPython'

        try:
            if "release" in os.listdir(self.CHANDLERBIN) and os.path.exists(os.path.join(self.CHANDLERBIN, "release", pyScript)):
                self.BINROOT = os.path.join(self.CHANDLERBIN, "release")

            elif "debug" in os.listdir(self.CHANDLERBIN) and os.path.exists(os.path.join(self.CHANDLERBIN, "debug", pyScript)):
                self.BINROOT = os.path.join(self.CHANDLERBIN, "debug")

            else:
                self.raiseError("No debug or release directory under CHANDLERBIN.")
        except:
            self.raiseError("CHANDLERBIN is invalid '%s'." % self.CHANDLERBIN)

        self.PYTHON = os.path.join(self.BINROOT, pyScript)
Esempio n. 2
0
def buildEXE(mode, options):
    os.chdir(options.buildDir)

    result     = None
    nsisBinary = findInPath(os.environ['PATH'], 'makensis.exe')

    if nsisBinary is None:
        log('Unable to locate makensis.exe in PATH', error=True)
    else:
        nsisPath   = os.path.join(options.buildDir, 'internal', 'installers', 'win')
        nsisScript = os.path.join(nsisPath, 'makeinstaller.sh')

        scriptFile = getCommand(['cygpath', '-aw', os.path.join(nsisPath, 'chandler.nsi')])

        cmd = [ nsisBinary, '/DSNAP_%s' % mode.upper(),
                            '/DDISTRIB_DIR=%s' % options.distribName,
                            '/DDISTRIB_VERSION=%s' % options.version_info['version'],
                            scriptFile ]

        r = runCommand(cmd)

        distribFile = '%s.exe' % options.distribName

        targetFile = os.path.join(options.buildDir, distribFile)
        sourceFile = os.path.join(nsisPath, 'Setup.exe')

        if os.path.exists(targetFile):
            os.remove(targetFile)

        if os.path.exists(sourceFile):
            os.rename(sourceFile, targetFile)

            result = distribFile

    if r:
        raise DistributionError(str(r))

    return result