def clean(buildenv): version = buildenv['version'] if buildenv['os'] == 'posix': buildDir=os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Removing temporary build directory: " + buildDir) hardhatlib.rmdir_recursive(buildDir) if buildenv['os'] == 'osx': buildDir=os.path.abspath("build_%s" % version) if os.access(buildDir, os.F_OK): hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, info['name'], "Removing temporary build directory: " + buildDir) hardhatlib.rmdir_recursive(buildDir) if buildenv['os'] == 'win': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['compiler'], "build/msw/msw.sln", "/clean", version.capitalize(), "/out", "output.txt"], "Cleaning %s %s" % (info['name'], version), 0, "output.txt") os.putenv('WXWIN', buildenv['root_dos'] + "\\..\\..\\internal\\wx\\wxPython-2.5") os.chdir("wxPython") if version == 'release': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['python'], 'setup.py', 'BUILD_BASE=build_release', 'clean', '--all'], "Cleaning wxPython") elif version == 'debug': hardhatlib.executeCommand( buildenv, info['name'], [buildenv['python_d'], 'setup.py', 'BUILD_BASE=build_debug', 'clean', '--all'], "Cleaning wxPython")
def distribute(buildenv): majorVersion, minorVersion, releaseVersion = _createVersionFile(buildenv) buildVersionShort = \ hardhatutil.RemovePunctuation(buildenv['buildVersion']) # When the build version string is based on one of our tags # (which usually begin with "CHANDLER_") let's remove the "CHANDLER_" # prefix from the string so it doesn't end up in the generated filenames # (so we can avoid getting a distro file named: # "Chandler_linux_CHANDLER_M1.tar.gz", and instead get: # "Chandler_linux_M1.tar.gz") buildVersionShort = buildVersionShort.replace("CHANDLER_", "") installTargetFile = None if buildenv['version'] == 'debug': if buildenv['os'] == 'osx': distName = 'Chandler_osx_debug_' + buildVersionShort # when we make an osx distribution, we actually need to put it # in a subdirectory (which has a .app extension). So we set # 'distdir' temporarily to that .app dir so that handleManifest() # puts things in the right place. Then we set 'distdir' to its # parent so that it gets cleaned up further down. distDirParent = buildenv['root'] + os.sep + distName distDir = distDirParent + os.sep + distName + ".app" buildenv['distdir'] = distDir if os.access(distDirParent, os.F_OK): hardhatlib.rmdir_recursive(distDirParent) os.mkdir(distDirParent) os.mkdir(distDir) manifestFile = "distrib/osx/manifest.debug.osx" hardhatlib.handleManifest(buildenv, manifestFile) makeDiskImage = buildenv['hardhatroot'] + os.sep + \ "makediskimage.sh" os.chdir(buildenv['root']) hardhatlib.executeCommand(buildenv, "HardHat", [makeDiskImage, distName], "Creating disk image from " + distName) compFile1 = distName + ".dmg" # reset 'distdir' up a level so that it gets removed below. buildenv['distdir'] = distDirParent distDir = distDirParent elif buildenv['os'] == 'posix': distName = 'Chandler_linux_debug_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib/linux/manifest.debug.linux" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller( buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) elif buildenv['os'] == 'win': distName = 'Chandler_win_debug_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib" + os.sep + "win" + os.sep + "manifest.debug.win" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) hardhatlib.convertLineEndings(buildenv['distdir']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller( buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) if buildenv['version'] == 'release': if buildenv['os'] == 'posix': distName = 'Chandler_linux_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib/linux/manifest.linux" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller( buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) if buildenv['os'] == 'osx': distName = 'Chandler_osx_' + buildVersionShort # when we make an osx distribution, we actually need to put it # in a subdirectory (which has a .app extension). So we set # 'distdir' temporarily to that .app dir so that handleManifest() # puts things in the right place. Then we set 'distdir' to its # parent so that it gets cleaned up further down. distDirParent = buildenv['root'] + os.sep + distName distDir = distDirParent + os.sep + distName + ".app" buildenv['distdir'] = distDir if os.access(distDirParent, os.F_OK): hardhatlib.rmdir_recursive(distDirParent) os.mkdir(distDirParent) os.mkdir(distDir) manifestFile = "distrib/osx/manifest.osx" hardhatlib.handleManifest(buildenv, manifestFile) makeDiskImage = buildenv['hardhatroot'] + os.sep + \ "makediskimage.sh" os.chdir(buildenv['root']) hardhatlib.executeCommand(buildenv, "HardHat", [makeDiskImage, distName], "Creating disk image from " + distName) compFile1 = distName + ".dmg" # reset 'distdir' up a level so that it gets removed below. buildenv['distdir'] = distDirParent distDir = distDirParent if buildenv['os'] == 'win': distName = 'Chandler_win_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib" + os.sep + "win" + os.sep + "manifest.win" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) hardhatlib.convertLineEndings(buildenv['distdir']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller( buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) # put the compressed files in the right place if specified 'outputdir' if buildenv['outputdir']: if buildenv['version'] == 'release': outputFlagFile = os.path.join(buildenv['outputdir'], 'enduser') else: outputFlagFile = os.path.join(buildenv['outputdir'], 'developer') if os.path.exists(outputFlagFile): os.remove(outputFlagFile) if not os.path.exists(buildenv['outputdir']): os.mkdir(buildenv['outputdir']) # The end-user distro if os.path.exists(buildenv['outputdir'] + os.sep + compFile1): os.remove(buildenv['outputdir'] + os.sep + compFile1) os.rename(compFile1, buildenv['outputdir'] + os.sep + compFile1) # The end-user installer if installTargetFile: installSource = os.path.join(buildenv['root'], installTargetFile) installTarget = os.path.join(buildenv['outputdir'], installTargetFile) if os.path.exists(installTarget): os.remove(installTarget) if os.path.exists(installSource): os.rename(installSource, installTarget) _outputLine(outputFlagFile, installTargetFile) # write out the compressed image _outputLine(outputFlagFile, compFile1) # remove the distribution directory, since we have a tarball/zip if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir)
def distribute(buildenv): majorVersion, minorVersion, releaseVersion = _createVersionFile(buildenv) buildVersionShort = \ hardhatutil.RemovePunctuation(buildenv['buildVersion']) # When the build version string is based on one of our tags # (which usually begin with "CHANDLER_") let's remove the "CHANDLER_" # prefix from the string so it doesn't end up in the generated filenames # (so we can avoid getting a distro file named: # "Chandler_linux_CHANDLER_M1.tar.gz", and instead get: # "Chandler_linux_M1.tar.gz") buildVersionShort = buildVersionShort.replace("CHANDLER_", "") installTargetFile = None if buildenv['version'] == 'debug': if buildenv['os'] == 'osx': distName = 'Chandler_osx_debug_' + buildVersionShort # when we make an osx distribution, we actually need to put it # in a subdirectory (which has a .app extension). So we set # 'distdir' temporarily to that .app dir so that handleManifest() # puts things in the right place. Then we set 'distdir' to its # parent so that it gets cleaned up further down. distDirParent = buildenv['root'] + os.sep + distName distDir = distDirParent + os.sep + distName + ".app" buildenv['distdir'] = distDir if os.access(distDirParent, os.F_OK): hardhatlib.rmdir_recursive(distDirParent) os.mkdir(distDirParent) os.mkdir(distDir) manifestFile = "distrib/osx/manifest.debug.osx" hardhatlib.handleManifest(buildenv, manifestFile) makeDiskImage = buildenv['hardhatroot'] + os.sep + \ "makediskimage.sh" os.chdir(buildenv['root']) hardhatlib.executeCommand(buildenv, "HardHat", [makeDiskImage, distName], "Creating disk image from " + distName) compFile1 = distName + ".dmg" # reset 'distdir' up a level so that it gets removed below. buildenv['distdir'] = distDirParent distDir = distDirParent elif buildenv['os'] == 'posix': distName = 'Chandler_linux_debug_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib/linux/manifest.debug.linux" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller(buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) elif buildenv['os'] == 'win': distName = 'Chandler_win_debug_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib" + os.sep + "win" + os.sep + "manifest.debug.win" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) hardhatlib.convertLineEndings(buildenv['distdir']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller(buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) if buildenv['version'] == 'release': if buildenv['os'] == 'posix': distName = 'Chandler_linux_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib/linux/manifest.linux" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller(buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) if buildenv['os'] == 'osx': distName = 'Chandler_osx_' + buildVersionShort # when we make an osx distribution, we actually need to put it # in a subdirectory (which has a .app extension). So we set # 'distdir' temporarily to that .app dir so that handleManifest() # puts things in the right place. Then we set 'distdir' to its # parent so that it gets cleaned up further down. distDirParent = buildenv['root'] + os.sep + distName distDir = distDirParent + os.sep + distName + ".app" buildenv['distdir'] = distDir if os.access(distDirParent, os.F_OK): hardhatlib.rmdir_recursive(distDirParent) os.mkdir(distDirParent) os.mkdir(distDir) manifestFile = "distrib/osx/manifest.osx" hardhatlib.handleManifest(buildenv, manifestFile) makeDiskImage = buildenv['hardhatroot'] + os.sep + \ "makediskimage.sh" os.chdir(buildenv['root']) hardhatlib.executeCommand(buildenv, "HardHat", [makeDiskImage, distName], "Creating disk image from " + distName) compFile1 = distName + ".dmg" # reset 'distdir' up a level so that it gets removed below. buildenv['distdir'] = distDirParent distDir = distDirParent if buildenv['os'] == 'win': distName = 'Chandler_win_' + buildVersionShort distDir = buildenv['root'] + os.sep + distName buildenv['distdir'] = distDir if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir) os.mkdir(distDir) manifestFile = "distrib" + os.sep + "win" + os.sep + "manifest.win" hardhatlib.handleManifest(buildenv, manifestFile) os.chdir(buildenv['root']) hardhatlib.convertLineEndings(buildenv['distdir']) compFile1 = hardhatlib.compressDirectory(buildenv, [distName], distName) installTargetFile = hardhatlib.makeInstaller(buildenv, [distName], distName, majorVersion, minorVersion, releaseVersion) # put the compressed files in the right place if specified 'outputdir' if buildenv['outputdir']: if buildenv['version'] == 'release': outputFlagFile = os.path.join(buildenv['outputdir'], 'enduser') else: outputFlagFile = os.path.join(buildenv['outputdir'], 'developer') if os.path.exists(outputFlagFile): os.remove(outputFlagFile) if not os.path.exists(buildenv['outputdir']): os.mkdir(buildenv['outputdir']) # The end-user distro if os.path.exists(buildenv['outputdir'] + os.sep + compFile1): os.remove(buildenv['outputdir'] + os.sep + compFile1) os.rename(compFile1, buildenv['outputdir'] + os.sep + compFile1) # The end-user installer if installTargetFile: installSource = os.path.join(buildenv['root'], installTargetFile) installTarget = os.path.join(buildenv['outputdir'], installTargetFile) if os.path.exists(installTarget): os.remove(installTarget) if os.path.exists(installSource): os.rename(installSource, installTarget) _outputLine(outputFlagFile, installTargetFile) # write out the compressed image _outputLine(outputFlagFile, compFile1) # remove the distribution directory, since we have a tarball/zip if os.access(distDir, os.F_OK): hardhatlib.rmdir_recursive(distDir)