Example #1
0
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")
Example #2
0
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)
Example #3
0
def build(buildenv):

    version = buildenv['version']

    if buildenv['os'] in ('osx', 'posix'):


        # Create the build directory

        buildDir = os.path.abspath("build_%s" % version)
        if os.access(buildDir, os.F_OK):
            hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, 
             info['name'], 
             "Temporary build directory exists: " + buildDir)
        else:
            hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, 
             info['name'], 
             "Temporary build directory doesn't exist; creating: " + \
              buildDir)
            os.mkdir(buildDir)
        os.chdir(buildDir)

        # Prepare the wxWidgets command line

        buildOptions = [
         buildenv['sh'], 
         '../configure', 
         '--prefix=%s' % os.path.join(buildenv['root'],version),
         '--disable-monolithic',
         '--enable-geometry',
         '--enable-sound',
         '--with-sdl',
         '--enable-display',
        ]

        if version == "debug":
            buildOptions.append("--enable-debug")
        else:
            buildOptions.append("--enable-optimized")

        if buildenv['os'] == "osx":
            buildOptions.append("--with-mac")
            buildOptions.append("--with-opengl")

        if buildenv['os'] == "posix":
            buildOptions.append("--with-gtk")
            buildOptions.append("--enable-gtk2")
            buildOptions.append("--enable-unicode")

        # Configure

        if os.access('Makefile', os.F_OK):
            hardhatlib.log(buildenv, hardhatlib.HARDHAT_MESSAGE, 
             info['name'], "Already configured")
        else:
            hardhatlib.executeCommand(buildenv, info['name'],
             buildOptions,
             "Configuring wxWindows %s" % version)

        # Make

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make']], "Making wxWindows")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/gizmos'], "Making gizmos")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'],
          '-Ccontrib/src/ogl',
          'CXXFLAGS="-DwxUSE_DEPRECATED=0"',
          ], "Making ogl")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/stc'], "Making stc")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/xrc'], "Making xrc")

        # Install

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], 'install'], "Installing wxWindows")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/gizmos', 'install'],
         "Installing gizmos")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/ogl', 'install'],
         "Installing ogl")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/stc', 'install'], 
         "Installing stc")

        hardhatlib.executeCommand(buildenv, info['name'],
         [buildenv['make'], '-Ccontrib/src/xrc', 'install'], 
         "Installing xrc")


        # wxPython

        if version == "debug":
            python = buildenv['python_d']
        else:
            python = buildenv['python']

        os.chdir("../wxPython")

        buildOptions = [
         python,
         'setup.py',
         'FINAL=1',
         'BUILD_OGL=0',
         'BUILD_GLCANVAS=0',
         'BUILD_BASE=build_%s' % version,
         'WX_CONFIG='+buildenv['root']+'/%s/bin/wx-config' % version,
        ]

        if buildenv['os'] == "posix":
            buildOptions.append("WXPORT=gtk2")
            buildOptions.append("UNICODE=1")

        buildOptions.append("build")
        if version == "debug":
            buildOptions.append("--debug")

        buildOptions.append("install")

        hardhatlib.executeCommand(buildenv, info['name'], buildOptions,
         "Building and Installing wxPython")


    # Windows

    if buildenv['os'] == 'win':

        hardhatlib.executeCommand( buildenv, info['name'],
         [buildenv['compiler'], 
         "build/msw/msw.sln",
         "/build",
         version.capitalize(),
         "/out",
         "output.txt"],
         "Building %s %s" % (info['name'], version),
         0, "output.txt")

        os.putenv('WXWIN', buildenv['root_dos'] + "\\..\\..\\internal\\wxPython-2.5")

        if version == 'release':
            destination = os.path.join (buildenv['pythonlibdir'], 'site-packages', 'wx')
            hardhatlib.copyFiles('lib/vc_dll', destination, ['*251_*.dll'])

            os.chdir("wxPython")
            hardhatlib.executeCommand (buildenv,
                                       info['name'],
                                       [buildenv['python'],
                                        'setup.py',
                                        'FINAL=1',
                                        'BUILD_BASE=build_release',
                                        'build', 
                                        'install'],
                                       "Building wxPython")

            # _*.pyd also copies _*_d.pyd, which is unnecessary, however, the
            # files that should have been created are _*.pyc, so when we fix that
            # we should change '_*.pyd' to '_*.pyc' in the following line
            hardhatlib.copyFiles('wx', destination, ['_*.pyd'])

        elif version == 'debug':
            destination = os.path.join (buildenv['pythonlibdir_d'], 'site-packages', 'wx')
            hardhatlib.copyFiles('lib/vc_dll', destination, ['*251d_*.dll'])

            os.chdir("wxPython")
            hardhatlib.executeCommand (buildenv,
                                       info['name'],
                                       [buildenv['python_d'],
                                        'setup.py',
                                        'FINAL=1',
                                        'BUILD_BASE=build_debug',
                                        'build',
                                        '--debug',
                                        'install'],
                                       "Building wxPython")

            hardhatlib.copyFiles('wx', destination, ['_*_d.pyd'])
Example #4
0
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)