diff --git a/build.py b/build.py index ea0b1c52..c8e34928 100755 --- a/build.py +++ b/build.py @@ -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) diff --git a/buildbot/master.cfg b/buildbot/master.cfg index 0172e475..909cec2a 100644 --- a/buildbot/master.cfg +++ b/buildbot/master.cfg @@ -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 diff --git a/buildtools/config.py b/buildtools/config.py index da01b026..1fca384a 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -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,