mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Merge remote-tracking branch 'supybot/maint/0.83.4' into testing
Conflicts: sandbox/release.py
This commit is contained in:
commit
18dd017e99
@ -383,7 +383,8 @@ class Filter(callbacks.Plugin):
|
|||||||
if c == ' ':
|
if c == ' ':
|
||||||
return c
|
return c
|
||||||
if fg is None:
|
if fg is None:
|
||||||
fg = str(random.randint(2, 15)).zfill(2)
|
fg = random.randint(2, 15)
|
||||||
|
fg = str(fg).zfill(2)
|
||||||
return '\x03%s%s' % (fg, c)
|
return '\x03%s%s' % (fg, c)
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
|
@ -4,6 +4,9 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from optparse import OptionParser
|
||||||
|
|
||||||
def firstLines(filename, n):
|
def firstLines(filename, n):
|
||||||
fd = file(filename)
|
fd = file(filename)
|
||||||
@ -11,6 +14,7 @@ def firstLines(filename, n):
|
|||||||
while n:
|
while n:
|
||||||
n -= 1
|
n -= 1
|
||||||
lines.append(fd.readline().rstrip('\r\n'))
|
lines.append(fd.readline().rstrip('\r\n'))
|
||||||
|
fd.close()
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
def firstLine(filename):
|
def firstLine(filename):
|
||||||
@ -20,62 +24,64 @@ def error(s):
|
|||||||
sys.stderr.write(s+'\n')
|
sys.stderr.write(s+'\n')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
def system(sh, errmsg=None):
|
def system(sh, errmsg=None, **kwargs):
|
||||||
if errmsg is None:
|
if errmsg is None:
|
||||||
|
if isinstance(sh, basestring):
|
||||||
errmsg = repr(sh)
|
errmsg = repr(sh)
|
||||||
ret = os.system(sh)
|
else:
|
||||||
|
errmsg = repr(' '.join(sh))
|
||||||
|
ret = subprocess.call(sh, **kwargs)
|
||||||
if ret:
|
if ret:
|
||||||
error(errmsg + ' (error code: %s)' % ret)
|
error(errmsg + ' (error code: %s)' % ret)
|
||||||
|
|
||||||
def usage():
|
|
||||||
error('Usage: %s [-s|-n] <sf username> <version>\nSpecify -s to pass it on '
|
|
||||||
'to the relevant git commands.\nSpecify -n to perform a dry-run '
|
|
||||||
'release. No commits or tags are pushed and no files are uploaded.'
|
|
||||||
'\nMust be called from a git checkout.'
|
|
||||||
% sys.argv[0])
|
|
||||||
|
|
||||||
def checkGitRepo():
|
def checkGitRepo():
|
||||||
system('test "$(git rev-parse --is-inside-work-tree)" = "true"',
|
system('test "$(git rev-parse --is-inside-work-tree)" = "true"',
|
||||||
'Must be run from a git checkout.')
|
'Must be run from a git checkout.',
|
||||||
|
shell=True)
|
||||||
system('test "$(git rev-parse --show-cdup >/dev/null)" = ""',
|
system('test "$(git rev-parse --show-cdup >/dev/null)" = ""',
|
||||||
'Must be run from the top-level directory of the git checkout.')
|
'Must be run from the top-level directory of the git checkout.',
|
||||||
|
shell=True)
|
||||||
system('git rev-parse --verify HEAD >/dev/null '
|
system('git rev-parse --verify HEAD >/dev/null '
|
||||||
'&& git update-index --refresh'
|
'&& git update-index --refresh'
|
||||||
'&& git diff-files --quiet'
|
'&& git diff-files --quiet'
|
||||||
'&& git diff-index --cached --quiet HEAD --',
|
'&& git diff-index --cached --quiet HEAD --',
|
||||||
'Your tree is unclean. Can\'t run from here.')
|
'Your tree is unclean. Can\'t run from here.',
|
||||||
|
shell=True)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) < 3 or len(sys.argv) > 5:
|
usage = 'usage: %prog [options] <username> <version>'
|
||||||
usage()
|
parser = OptionParser(usage=usage)
|
||||||
|
parser.set_defaults(sign=False, verbose=False, branch='master')
|
||||||
|
parser.add_option('-s', '--sign', action='store_true', dest='sign',
|
||||||
|
help='Pass on -s to relevant git commands')
|
||||||
|
parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
|
||||||
|
help='Build the release, but do not push to the git '
|
||||||
|
'remote or upload the release archives.')
|
||||||
|
parser.add_option('-b', '--branch', metavar='BRANCH', dest='branch',
|
||||||
|
help='Branch to use for the release. Default: %default')
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if len(args) != 2:
|
||||||
|
parser.error('Both username and version must be specified')
|
||||||
|
|
||||||
|
(u, v) = args
|
||||||
|
if not re.match(r'^\d+\.\d+\.\d+(\.\d+)?\w*$', v):
|
||||||
|
parser.error('Invalid version string: '
|
||||||
|
'must be of the form MAJOR.MINOR.PATCHLEVEL')
|
||||||
|
|
||||||
checkGitRepo()
|
checkGitRepo()
|
||||||
|
|
||||||
sign = ''
|
sign = options.sign
|
||||||
dryrun = False
|
dryrun = options.dry_run
|
||||||
while len(sys.argv) > 3:
|
branch = options.branch
|
||||||
if sys.argv[1] == '-s':
|
|
||||||
sign = '-s'
|
|
||||||
sys.argv.pop(1)
|
|
||||||
elif sys.argv[1] == '-n':
|
|
||||||
dryrun = True
|
|
||||||
sys.argv.pop(1)
|
|
||||||
else:
|
|
||||||
usage()
|
|
||||||
|
|
||||||
print 'Check version string for validity.'
|
|
||||||
(u, v) = sys.argv[1:]
|
|
||||||
if not re.match(r'^\d+\.\d+\.\d+(\.\d+)?\w*$', v):
|
|
||||||
error('Invalid version string: '
|
|
||||||
'must be of the form MAJOR.MINOR.PATCHLEVEL.')
|
|
||||||
|
|
||||||
if os.path.exists('supybot'):
|
if os.path.exists('supybot'):
|
||||||
error('I need to make the directory "supybot" but it already exists.'
|
error('I need to make the directory "supybot" but it already exists.'
|
||||||
' Change to an appropriate directory or remove the supybot '
|
' Change to an appropriate directory or remove the supybot '
|
||||||
'directory to continue.')
|
'directory to continue.')
|
||||||
print 'Checking out fresh tree from git.'
|
print 'Checking out fresh tree from git.'
|
||||||
system('git clone git+ssh://%s@supybot.git.sourceforge.net/gitroot/supybot'
|
repo = 'git+ssh://%s@supybot.git.sourceforge.net/gitroot/supybot/supybot' % u
|
||||||
% u)
|
system(['git', 'clone', '-b', branch, repo])
|
||||||
os.chdir('supybot')
|
os.chdir('supybot')
|
||||||
|
|
||||||
print 'Checking RELNOTES version line.'
|
print 'Checking RELNOTES version line.'
|
||||||
@ -90,38 +96,47 @@ if __name__ == '__main__':
|
|||||||
error('Invalid third line in ChangeLog.')
|
error('Invalid third line in ChangeLog.')
|
||||||
|
|
||||||
print 'Updating version in version files.'
|
print 'Updating version in version files.'
|
||||||
versionFiles = ('src/version.py')
|
versionFiles = ['src/version.py']
|
||||||
for fn in versionFiles:
|
for fn in versionFiles:
|
||||||
sh = 'perl -pi -e "s/^version\s*=.*/version = \'%s\'/" %s' % (v, fn)
|
sh = ['perl', '-pi', '-e', 's/^version\s*=.*/version = \'%s\'/' % v, fn]
|
||||||
system(sh, 'Error changing version in %s' % fn)
|
system(sh, 'Error changing version in %s' % fn)
|
||||||
system('git commit %s -m \'Updated to %s.\' %s'
|
commit = ['git', 'commit']
|
||||||
% (sign, v, ' '.join(versionFiles)))
|
if sign:
|
||||||
|
commit.append('-s')
|
||||||
|
system(commit + ['-m', 'Updated to %s.' % v] + versionFiles)
|
||||||
|
|
||||||
print 'Tagging release.'
|
print 'Tagging release.'
|
||||||
system('git tag %s -m "Release %s" %s' % (sign or '-a', v, v))
|
tag = ['git', 'tag']
|
||||||
|
if sign:
|
||||||
|
tag.append('-s')
|
||||||
|
system(tag + ['-m', "Release %s" % v, 'v%s' % v])
|
||||||
|
|
||||||
print 'Committing %s+git to version files.' % v
|
print 'Committing %s+git to version files.' % v
|
||||||
for fn in versionFiles:
|
for fn in versionFiles:
|
||||||
sh = 'perl -pi -e "s/^version\s*=.*/version = \'%s\'/" %s' % \
|
system(['perl', '-pi', '-e',
|
||||||
(v + '+git', fn)
|
's/^version\s*=.*/version = \'%s+git\'/' % v, fn],
|
||||||
system(sh, 'Error changing version in %s' % fn)
|
'Error changing version in %s' % fn)
|
||||||
system('git commit %s -m \'Updated to %s+git.\' %s'
|
system(commit + ['-m', 'Updated to %s+git.' % v] + versionFiles)
|
||||||
% (sign, v, ' '.join(versionFiles)))
|
|
||||||
|
|
||||||
if not dryrun:
|
if not dryrun:
|
||||||
print 'Pushing commits and tag.'
|
print 'Pushing commits and tag.'
|
||||||
system('git push origin master')
|
system(['git', 'push', 'origin', branch])
|
||||||
system('git push --tags')
|
system(['git', 'push', '--tags'])
|
||||||
|
|
||||||
|
archive = ['git', 'archive', '--prefix=Supybot-%s/' % v]
|
||||||
print 'Creating tarball (gzip).'
|
print 'Creating tarball (gzip).'
|
||||||
system('git archive --prefix=Supybot-%s/ --format=tar %s '
|
system(archive + ['-o', '../Supybot-%s.tar.gz' % v,
|
||||||
'| gzip -c >../Supybot-%s.tar.gz' % (v, v, v))
|
'--format=tgz', 'v%s' % v])
|
||||||
|
|
||||||
|
system(['git', 'config', 'tar.bz2.command', 'bzip2 -c'])
|
||||||
|
|
||||||
print 'Creating tarball (bzip2).'
|
print 'Creating tarball (bzip2).'
|
||||||
system('git archive --prefix=Supybot-%s/ --format=tar %s '
|
system(archive + ['-o', '../Supybot-%s.tar.bz2' % v,
|
||||||
'| bzip2 -c >../Supybot-%s.tar.bz2' % (v, v, v))
|
'--format=bz2', 'v%s' % v])
|
||||||
|
|
||||||
print 'Creating zip.'
|
print 'Creating zip.'
|
||||||
system('git archive --prefix=Supybot-%s/ --format=zip %s '
|
system(archive + ['-o', '../Supybot-%s.zip' % v,
|
||||||
'>../Supybot-%s.zip' % (v, v, v))
|
'--format=zip', 'v%s' % v])
|
||||||
|
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
shutil.rmtree('supybot')
|
shutil.rmtree('supybot')
|
||||||
|
4
setup.py
4
setup.py
@ -49,6 +49,8 @@ import os
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
from src.version import version
|
||||||
|
|
||||||
plugins = [s for s in os.listdir('plugins') if
|
plugins = [s for s in os.listdir('plugins') if
|
||||||
os.path.exists(os.path.join('plugins', s, 'plugin.py'))]
|
os.path.exists(os.path.join('plugins', s, 'plugin.py'))]
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ setup(
|
|||||||
name='supybot',
|
name='supybot',
|
||||||
version=version,
|
version=version,
|
||||||
author='Jeremy Fincher',
|
author='Jeremy Fincher',
|
||||||
url='http://supybot.com/',
|
url='http://sourceforge.net/projects/supybot/',
|
||||||
author_email='jemfinch@supybot.com',
|
author_email='jemfinch@supybot.com',
|
||||||
download_url='http://www.sf.net/project/showfiles.php?group_id=58965',
|
download_url='http://www.sf.net/project/showfiles.php?group_id=58965',
|
||||||
description='A flexible and extensible Python IRC bot and framework.',
|
description='A flexible and extensible Python IRC bot and framework.',
|
||||||
|
@ -412,10 +412,15 @@ class FormatParser(object):
|
|||||||
i = 0
|
i = 0
|
||||||
setI = False
|
setI = False
|
||||||
c = self.getChar()
|
c = self.getChar()
|
||||||
while c.isdigit() and i < 100:
|
while c.isdigit():
|
||||||
|
j = i * 10
|
||||||
|
j += int(c)
|
||||||
|
if j >= 16:
|
||||||
|
self.ungetChar(c)
|
||||||
|
break
|
||||||
|
else:
|
||||||
setI = True
|
setI = True
|
||||||
i *= 10
|
i = j
|
||||||
i += int(c)
|
|
||||||
c = self.getChar()
|
c = self.getChar()
|
||||||
self.ungetChar(c)
|
self.ungetChar(c)
|
||||||
if setI:
|
if setI:
|
||||||
@ -428,6 +433,8 @@ class FormatParser(object):
|
|||||||
c = self.getChar()
|
c = self.getChar()
|
||||||
if c == ',':
|
if c == ',':
|
||||||
context.bg = self.getInt()
|
context.bg = self.getInt()
|
||||||
|
else:
|
||||||
|
self.ungetChar(c)
|
||||||
|
|
||||||
def wrap(s, length):
|
def wrap(s, length):
|
||||||
processed = []
|
processed = []
|
||||||
|
3
src/version.py
Normal file
3
src/version.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"""stick the various versioning attributes in here, so we only have to change
|
||||||
|
them once."""
|
||||||
|
version = '0.83.4.1+git'
|
Loading…
Reference in New Issue
Block a user