示例#1
0
def collectTarballs(projectObjects, exportPath, releasePath):
    """
    Collect tarballs in the releases/ directory.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to make tags.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains release tarballs previously
        generated with L{doSourceDist}.

    @type releasePath: L{FilePath}
    @param releasePath: A directory which will have a I{releases} subdirectory
        added to it (if one does not already exist) into which the tarballs
        will be moved.
    """
    releasePath = releasePath.child('releases')
    if not releasePath.isdir():
        releasePath.makedirs()

    for proj in projectObjects:

        def collectTarball():
            projectExport = exportPath.child(proj.name)
            releaseFile = '%s-%s.tar.gz' % (proj.name, proj.version.short())
            projectPath = projectExport.child('dist').child(releaseFile)
            projectPath.moveTo(releasePath.child(releaseFile))

        runChdirSafe(collectTarball)
示例#2
0
def runTests(projectObjects, installPath, prompt, sh=sh):
    """
    Run unit tests for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to run tests.

    @type installPath: L{FilePath}
    @param installPath: The installation prefix path which contains the
        packages for which to run tests.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    # distutils.sysconfig.get_python_lib(prefix=...) might be more appropriate
    libPath = installPath.child('lib')
    pythonPath = libPath.child('python%d.%d' % sys.version_info[:2])
    siteInstallPath = pythonPath.child('site-packages')
    for proj in projectObjects:

        def testSourceInstall():
            cmd = 'PYTHONPATH=%(installPath)s:$PYTHONPATH trial %(projectName)s'
            sh(cmd % {
                'installPath': siteInstallPath.path,
                'projectName': proj.initPath.parent().basename()
            },
               null=False,
               prompt=prompt)

        runChdirSafe(testSourceInstall)
示例#3
0
def makeTags(projectObjects, repo, branchURI, prompt, sh=sh):
    """
    Make SVN tags for the code in these projects.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to make tags.

    @type repo: C{str}
    @param repo: The segment of the repository URI immediately before the
        {trunk,branches,tags} segment.

    @type branchURI: C{str}
    @param branchURI: The URI of the branch for which to create a tag.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    #XXX Maybe this should be a parameter too?
    tagRootURI = 'svn+ssh://divmod.org/svn/%s/tags/releases' % (repo, )
    for proj in projectObjects:

        def tagRelease():
            source = '%(branchURI)s/%(projectName)s'
            dest = '%(tagRootURI)s/%(projectName)s-%(projectVersion)s'
            cmd = 'svn cp %s %s -m "Tagging release"' % (source, dest)
            sh(cmd % {
                'branchURI': branchURI,
                'projectName': proj.name,
                'tagRootURI': tagRootURI,
                'projectVersion': proj.version.short()
            },
               null=False,
               prompt=prompt)

        runChdirSafe(tagRelease)
示例#4
0
def doSourceUnpack(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Unpack source tarballs for projects.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to unpack tarballs.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.  These should have previously had tarballs
        created for them with L{doSourceDist}.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    for proj in projectObjects:

        def unpackSourceRelease():
            projectExport = exportPath.child(proj.name)
            chdir(projectExport.child('dist').path)
            cmd = 'tar xzf %(projectName)s-%(projectVersion)s.tar.gz'
            sh(cmd % {
                'projectName': proj.name,
                'projectVersion': proj.version.short()
            },
               null=False,
               prompt=prompt)

        runChdirSafe(unpackSourceRelease)
示例#5
0
文件: release.py 项目: bne/squeal
def collectTarballs(projectObjects, exportPath, releasePath):
    """
    Collect tarballs in the releases/ directory.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to make tags.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains release tarballs previously
        generated with L{doSourceDist}.

    @type releasePath: L{FilePath}
    @param releasePath: A directory which will have a I{releases} subdirectory
        added to it (if one does not already exist) into which the tarballs
        will be moved.
    """
    releasePath = releasePath.child('releases')
    if not releasePath.isdir():
        releasePath.makedirs()

    for proj in projectObjects:
        def collectTarball():
            projectExport = exportPath.child(proj.name)
            releaseFile = '%s-%s.tar.gz' % (proj.name,
                                            proj.version.short())
            projectPath = projectExport.child('dist').child(releaseFile)
            projectPath.moveTo(releasePath.child(releaseFile))
        runChdirSafe(collectTarball)
示例#6
0
文件: release.py 项目: bne/squeal
def makeTags(projectObjects, repo, branchURI, prompt, sh=sh):
    """
    Make SVN tags for the code in these projects.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to make tags.

    @type repo: C{str}
    @param repo: The segment of the repository URI immediately before the
        {trunk,branches,tags} segment.

    @type branchURI: C{str}
    @param branchURI: The URI of the branch for which to create a tag.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    #XXX Maybe this should be a parameter too?
    tagRootURI = 'svn+ssh://divmod.org/svn/%s/tags/releases' % (repo,)
    for proj in projectObjects:
        def tagRelease():
            source = '%(branchURI)s/%(projectName)s'
            dest = '%(tagRootURI)s/%(projectName)s-%(projectVersion)s'
            cmd = 'svn cp %s %s -m "Tagging release"' % (source, dest)
            sh(cmd % {'branchURI': branchURI,
                      'projectName': proj.name,
                      'tagRootURI': tagRootURI,
                      'projectVersion': proj.version.short()},
               null=False,
               prompt=prompt)

        runChdirSafe(tagRelease)
示例#7
0
文件: release.py 项目: bne/squeal
def runTests(projectObjects, installPath, prompt, sh=sh):
    """
    Run unit tests for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to run tests.

    @type installPath: L{FilePath}
    @param installPath: The installation prefix path which contains the
        packages for which to run tests.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    # distutils.sysconfig.get_python_lib(prefix=...) might be more appropriate
    libPath = installPath.child('lib')
    pythonPath = libPath.child('python%d.%d' % sys.version_info[:2])
    siteInstallPath = pythonPath.child('site-packages')
    for proj in projectObjects:
        def testSourceInstall():
            cmd = 'PYTHONPATH=%(installPath)s:$PYTHONPATH trial %(projectName)s'
            sh(cmd % {'installPath': siteInstallPath.path,
                      'projectName': proj.initPath.parent().basename()},
               null=False,
               prompt=prompt)

        runChdirSafe(testSourceInstall)
示例#8
0
文件: release.py 项目: bne/squeal
def doInstall(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Run distutils installation for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects to install.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.  These should have previously had tarballs
        created and unpacked with L{doSourceDist} and L{doSourceUnpack}.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.

    @rtype: L{FilePath}
    @return: The installation prefix path.
    """
    installPath = FilePath('.install').temporarySibling()
    for proj in projectObjects:
        def installSourceRelease():
            projectExport = exportPath.child(proj.name)
            projectDir = '%s-%s' % (proj.name, proj.version.short())
            unpackPath = projectExport.child('dist').child(projectDir)
            chdir(unpackPath.path)
            cmd = '%(python)s setup.py install --prefix %(installPath)s'
            sh(cmd % {'python': sys.executable,
                      'installPath': installPath.path},
               null=False,
               prompt=prompt)

        runChdirSafe(installSourceRelease)
    return installPath
示例#9
0
文件: release.py 项目: bne/squeal
def doSourceUnpack(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Unpack source tarballs for projects.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to unpack tarballs.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.  These should have previously had tarballs
        created for them with L{doSourceDist}.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    for proj in projectObjects:
        def unpackSourceRelease():
            projectExport = exportPath.child(proj.name)
            chdir(projectExport.child('dist').path)
            cmd = 'tar xzf %(projectName)s-%(projectVersion)s.tar.gz'
            sh(cmd % {'projectName': proj.name,
                      'projectVersion': proj.version.short()},
               null=False,
               prompt=prompt)

        runChdirSafe(unpackSourceRelease)
示例#10
0
def doSourceDist(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Create tarballs with distutils for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to create tarballs.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    for proj in projectObjects:

        def makeSourceRelease():
            chdir(exportPath.child(proj.name).path)
            cmd = '%(python)s setup.py sdist'
            sh(cmd % {'python': sys.executable}, null=False, prompt=prompt)

        runChdirSafe(makeSourceRelease)
示例#11
0
文件: release.py 项目: bne/squeal
def doSourceDist(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Create tarballs with distutils for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects for which to create tarballs.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.
    """
    for proj in projectObjects:
        def makeSourceRelease():
            chdir(exportPath.child(proj.name).path)
            cmd = '%(python)s setup.py sdist'
            sh(cmd % {'python': sys.executable},
               null=False,
               prompt=prompt)

        runChdirSafe(makeSourceRelease)
示例#12
0
def doInstall(projectObjects, exportPath, prompt, sh=sh, chdir=chdir):
    """
    Run distutils installation for each project.

    @type projectObjects: C{list} of L{Project} instances
    @param projectObjects: The projects to install.

    @type exportPath: L{FilePath}
    @param exportPath: The directory which contains svn exports of all of the
        projects to operate on.  These should have previously had tarballs
        created and unpacked with L{doSourceDist} and L{doSourceUnpack}.

    @type prompt: C{bool}
    @param prompt: If true, ask the user before executing any shell commands.

    @rtype: L{FilePath}
    @return: The installation prefix path.
    """
    installPath = FilePath('.install').temporarySibling()
    for proj in projectObjects:

        def installSourceRelease():
            projectExport = exportPath.child(proj.name)
            projectDir = '%s-%s' % (proj.name, proj.version.short())
            unpackPath = projectExport.child('dist').child(projectDir)
            chdir(unpackPath.path)
            cmd = '%(python)s setup.py install --prefix %(installPath)s'
            sh(cmd % {
                'python': sys.executable,
                'installPath': installPath.path
            },
               null=False,
               prompt=prompt)

        runChdirSafe(installSourceRelease)
    return installPath