Commit 1b65fff8 authored by Denis Bilenko's avatar Denis Bilenko

Merge branch 'utilupdate'

parents 9b1bccff c0991f95
......@@ -55,15 +55,11 @@ def makedist(*args, **kwargs):
os.chdir(cwd)
def _makedist(version='dev', dest=None):
def _makedist(version=None, dest=None):
assert exists('gevent/__init__.py'), 'Where am I?'
basedir = abspath(os.getcwd())
if version.lower() == 'dev':
set_version_command = 'util/set_version.py gevent/__init__.py'
else:
set_version_command = 'util/set_version.py --version %s gevent/__init__.py' % version
version = version or 'dev'
set_version_command = 'util/set_version.py --version %s ./gevent/__init__.py' % version
os.chdir('/tmp')
system('rm -fr ' + TMPDIR)
os.mkdir(TMPDIR)
......@@ -75,6 +71,7 @@ def _makedist(version='dev', dest=None):
assert len(directory) == 1, directory
os.chdir(directory[0])
system('git branch')
system(set_version_command)
system('git diff', noisy=False)
system('python setup.py -q sdist')
......@@ -99,12 +96,10 @@ def _makedist(version='dev', dest=None):
def main():
parser = optparse.OptionParser()
parser.add_option('--dest')
parser.add_option('--version')
options, args = parser.parse_args()
if len(args) != 1:
sys.exit('Expected one argument: version (could be "dev").')
return makedist(args[0], dest=options.dest)
assert not args, 'Expected no arguments'
return makedist(options.version, dest=options.dest)
def copy(source, dest):
......
......@@ -12,8 +12,8 @@ from optparse import OptionParser
from distutils.version import LooseVersion
version_re = re.compile("__version__\s*=\s*'([^']+)'", re.M)
version_info_re = re.compile(r"version_info\s*=\s*([^\n]+)")
version_re = re.compile("^__version__\s*=\s*'([^']+)'", re.M)
version_info_re = re.compile(r"^version_info\s*=\s*([^\n]+)", re.M)
strict_version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE)
......@@ -129,16 +129,25 @@ def write(filename, data):
def main():
global options
parser = OptionParser()
parser.add_option('--version')
parser.add_option('--version', default='dev')
parser.add_option('--dry-run', action='store_true')
options, args = parser.parse_args()
if options.version:
if strict_version_re.match(options.version) is None:
sys.exit('Not a strict version: %r (bdist_msi will fail)' % options.version)
assert len(args) == 1, args
assert len(args) == 1, 'One argument is expected, got %s' % len(args)
version = options.version
if version.lower() == 'dev':
version = ''
if version and strict_version_re.match(version) is None:
sys.stderr.write('WARNING: Not a strict version: %r (bdist_msi will fail)' % version)
filename = args[0]
original_content, new_content = modify_version(filename, options.version)
write(filename, new_content)
print 'Updated %s' % filename
original_content, new_content = modify_version(filename, version)
if options.dry_run:
tmpname = '/tmp/' + os.path.basename(filename) + '.set_version'
write(tmpname, new_content)
if not os.system('diff -u %s %s' % (filename, tmpname)):
sys.exit('No differences applied')
else:
write(filename, new_content)
print 'Updated %s' % filename
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment