Change --upload_package to --upload.

Simplify cleanup of older snapshot uploads.  Just keep the last 50 files instead of trying to keep 5 of each type.  It's too easy for those filters to break.

Add ability to upload eggs, wheels, and exe's

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75501 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-12-31 07:48:11 +00:00
parent a9f2eee579
commit 72fee9de94
3 changed files with 38 additions and 19 deletions

View File

@@ -378,7 +378,7 @@ def makeOptionParser():
("unicode", (True, "Build wxPython with unicode support (always on for wx2.9+)")),
("verbose", (False, "Print out more information.")),
("nodoc", (False, "Do not run the default docs generator")),
("upload_package", (False, "Upload bdist and/or sdist packages to snapshot server.")),
("upload", (False, "Upload bdist and/or sdist packages to snapshot server.")),
("cairo", (False, "Allow Cairo use with wxGraphicsContext (Windows only)")),
("x64", (False, "Use and build for the 64bit version of Python on Windows")),
("jom", (False, "Use jom instead of nmake for the wxMSW build")),
@@ -544,13 +544,12 @@ class CommandTimer(object):
def uploadPackage(fileName, matchString, keep=5):
def uploadPackage(fileName, KEEP=50):
"""
Upload the given filename to the configured package server location.
Only the `keep` number of files containing `matchString` will be
kept, any others will be removed from the server. It is assumed that
if the files are in sorted order then the end of the list will be the
newest files.
Upload the given filename to the configured package server location. Only
the KEEP most recent files will be kept so the server spece is not overly
consumed. It is assumed that if the files are in sorted order then the
end of the list will be the newest files.
"""
msg("Preparing to upload %s..." % fileName)
configfile = os.path.join(os.getenv("HOME"), "phoenix_package_server.cfg")
@@ -573,11 +572,11 @@ def uploadPackage(fileName, matchString, keep=5):
ftp.storbinary('STOR %s' % ftp_path, f)
f.close()
allFiles = [name for name in ftp.nlst(ftp_dir) if matchString in name]
allFiles = ftp.nlst(ftp_dir)
allFiles.sort() # <== if an alpha sort is not the correct order, pass a cmp function!
# leave the last 5 builds, including this new one, on the server
for name in allFiles[:-keep]:
# leave the last KEEP builds, including this new one, on the server
for name in allFiles[:-KEEP]:
msg("Deleting %s" % name)
ftp.delete(name)
@@ -813,8 +812,8 @@ def cmd_docs_bdist(options, args):
filter=lambda info: None if '.svn' in info.name else info)
tarball.close()
if options.upload_package:
uploadPackage(tarfilename, '-docs')
if options.upload:
uploadPackage(tarfilename)
msg('Documentation tarball built at %s' % tarfilename)
@@ -1216,12 +1215,32 @@ def _doSimpleSetupCmd(options, args, setupCmd):
def cmd_bdist_egg(options, args):
_doSimpleSetupCmd(options, args, 'bdist_egg')
cfg = Config()
if options.upload:
filemask = "dist/%s-%s-*.egg" % (baseName, cfg.VERSION)
filenames = glob.glob(filemask)
assert len(filenames) == 1
uploadPackage(filenames[0])
def cmd_bdist_wheel(options, args):
_doSimpleSetupCmd(options, args, 'bdist_wheel')
cfg = Config()
if options.upload:
filemask = "dist/%s-%s-*.whl" % (baseName, cfg.VERSION)
filenames = glob.glob(filemask)
assert len(filenames) == 1
uploadPackage(filenames[0])
def cmd_bdist_wininst(options, args):
_doSimpleSetupCmd(options, args, 'bdist_wininst')
cfg = Config()
if options.upload:
filemask = "dist/%s-%s-*.exe" % (baseName, cfg.VERSION)
filenames = glob.glob(filemask)
assert len(filenames) == 1
uploadPackage(filenames[0])
# bdist_msi requires the version number to be only 3 components, but we're
# using 4. TODO: Can we fix this?
@@ -1427,8 +1446,8 @@ def cmd_sdist(options, args):
del pwd
shutil.rmtree(ADEST)
if options.upload_package:
uploadPackage(tarfilename, '-src')
if options.upload:
uploadPackage(tarfilename)
msg("Source release built at %s" % tarfilename)
@@ -1478,8 +1497,8 @@ def cmd_bdist(options, args):
tarball.add('packaging/README-bdist.txt', os.path.join(rootname, 'README.txt'))
tarball.close()
if options.upload_package:
uploadPackage(tarfilename, '-%s-py%s' % (platform, PYVER))
if options.upload:
uploadPackage(tarfilename)
msg("Binary release built at %s" % tarfilename)

View File

@@ -162,7 +162,7 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'):
if buildType == 'docs':
cmd = 'python -u build.py %s setrev dox touch etg sip build wxlib wxtools wxpy ' \
'sphinx docs_bdist sdist --upload_package' % pyVer
'sphinx docs_bdist sdist --upload' % pyVer
else:
cmd = 'python -u build.py %s %s setrev dox touch etg --nodoc sip build' % (pyVer, clean)
if port == 'osx':
@@ -179,7 +179,7 @@ def makeFactory(port, buildType='buildOnly', pyVer='2.7'):
if port == 'win64':
cmd += ' --x64'
if buildType == 'dist':
cmd += ' bdist --upload_package'
cmd += ' bdist --upload'
factory.addStep(ShellCommand(command=cmd.split(), workdir="Phoenix"))
return factory

View File

@@ -335,7 +335,7 @@ class Configuration(object):
# is a release build. (In theory)
if os.path.exists('REV.txt'):
f = open('REV.txt')
self.VER_FLAGS = '-' + f.read().strip()
self.VER_FLAGS = '_' + f.read().strip()
f.close()
self.VERSION = "%s.%s.%s.%s%s" % (self.VER_MAJOR,