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
def buildTarball(mode, options): os.chdir(options.buildDir) if options.platformID == 'win': distribFile = '%s.zip' % options.distribName cmd = [ findInPath(os.environ['PATH'], 'zip'), '-r', distribFile, options.distribName ] else: distribFile = '%s.tar.gz' % options.distribName cmd = [ 'tar', 'czf', distribFile, options.distribName ] if os.path.isfile(distribFile): os.remove(distribFile) r = runCommand(cmd) log('Compressed distribution file created (%d)' % r) if r: raise DistributionError(str(r)) return distribFile
if build == 'tarball': options.distribFiles[mode].append(buildTarball(mode, options)) if build == 'dmg': options.distribFiles[mode].append(buildDMG(mode, options)) if build == 'exe': options.distribFiles[mode].append(buildEXE(mode, options)) if build == 'rpm': options.distribFiles[mode].append(buildRPM(mode, options)) if build == 'deb': options.distribFiles[mode].append(buildDEB(mode, options)) if options.outputDir <> options.buildDir: generateTinderboxOutput(mode, options.distribFiles[mode]) if os.access(options.distribDir, os.F_OK): rmdirs(options.distribDir) if _debug: log(options.distribFiles[mode]) else: log('Skipping %s because the directory is not present' % mode, error=True) except DistributionError: success = False # revert the contents of version.py to clear any previously generated values runCommand([ findInPath(os.environ['PATH'], 'svn'), 'revert', os.path.join(options.sourceDir, 'version.py') ]) if not success: sys.exit('Failed to create distributions')