misc fixes

Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
Mattias Andrée 2013-04-03 23:49:21 +02:00
parent 3c583c278f
commit c38b34a000
4 changed files with 21 additions and 27 deletions

View file

@ -421,7 +421,7 @@ class Setup():
data = data.replace('#!/usr/bin/env python3', '#!/usr/bin/env ' + env) data = data.replace('#!/usr/bin/env python3', '#!/usr/bin/env ' + env)
else: else:
data = data.replace('#!/usr/bin/env python', '#!/usr/bin/env ' + env) data = data.replace('#!/usr/bin/env python', '#!/usr/bin/env ' + env)
data = data.replace('/usr/share/', conf['share-dir'] if conf['share-dir'].endswith('/') else (conf['share-dir'] + '/')) data = data.replace('/usr/share/ponysay/', conf['share-dir'] + ('' if conf['share-dir'].endswith('/') else '/'))
data = data.replace('/etc/', conf['sysconf-dir'] + ('' if conf['sysconf-dir'].endswith('/') else '/')) data = data.replace('/etc/', conf['sysconf-dir'] + ('' if conf['sysconf-dir'].endswith('/') else '/'))
data = data.replace('\nVERSION = \'dev\'', '\nVERSION = \'%s\'' % (PONYSAY_VERSION)) data = data.replace('\nVERSION = \'dev\'', '\nVERSION = \'%s\'' % (PONYSAY_VERSION))
@ -429,14 +429,10 @@ class Setup():
finally: finally:
if fileout is not None: fileout.close() if fileout is not None: fileout.close()
if filein is not None: filein .close() if filein is not None: filein .close()
try:
os.chdir('src')
print('Creating uncompressed zip file ponysay.zip with files from src: ' + ' '.join(ponysaysrc)) print('Creating uncompressed zip file ponysay.zip with files from src: ' + ' '.join(ponysaysrc))
with ZipFile('../ponysay.zip', 'w') as myzip: with ZipFile('ponysay.zip', 'w') as myzip:
for src in ponysaysrc: for src in ponysaysrc:
myzip.write(src) myzip.write('src/%s.install' % src, src)
finally:
os.chdir('..')
os.chmod('ponysay.zip', 0o755) os.chmod('ponysay.zip', 0o755)
try: try:
fileout = open('ponysay.install', 'wb+') fileout = open('ponysay.install', 'wb+')
@ -530,7 +526,7 @@ class Setup():
data = data.replace('/usr/bin/ponysay', conf[command]) data = data.replace('/usr/bin/ponysay', conf[command])
data = data.replace('/ponysay', '\0') data = data.replace('/ponysay', '\0')
data = data.replace('ponysay', command) data = data.replace('ponysay', command)
data = data.replace('/usr/share/', conf['share-dir'] if conf['share-dir'].endswith('/') else (conf['share-dir'] + '/')) data = data.replace('/usr/share/ponysay/', conf['share-dir'] if conf['share-dir'].endswith('/') else (conf['share-dir'] + '/'))
data = data.replace('\0', '/ponysay') data = data.replace('\0', '/ponysay')
fileout.write(data.encode('utf-8')) fileout.write(data.encode('utf-8'))
@ -992,21 +988,20 @@ class Setup():
conf['~prefix~'] = prefix conf['~prefix~'] = prefix
if opts['--opt'] is not None: if opts['--opt'] is not None:
if opts['--bin-dir'] is None: opts['--bin-dir'] = ['/opt/ponysay/bin'] if opts['--bin-dir'] is None: opts['--bin-dir'] = ['/opt/ponysay']
if opts['--lib-dir'] is None: opts['--lib-dir'] = ['/opt/ponysay/lib'] if opts['--lib-dir'] is None: opts['--lib-dir'] = ['/opt/ponysay']
if opts['--libexec-dir'] is None: opts['--libexec-dir'] = ['/opt/ponysay/libexec'] if opts['--libexec-dir'] is None: opts['--libexec-dir'] = ['/opt/ponysay']
if opts['--share-dir'] is None: opts['--share-dir'] = ['/opt/ponysay/share'] if opts['--share-dir'] is None: opts['--share-dir'] = ['/opt/ponysay']
if opts['--with-shared-cache'] is None: opts['--with-shared-cache'] = ['/var/opt/ponysay/cache'] if opts['--with-shared-cache'] is None: opts['--with-shared-cache'] = ['/var/opt/ponysay/cache']
for dir in ['bin', 'lib', 'libexec', 'share']: for dir in ['bin', 'lib', 'libexec', 'share']:
if opts['--' + dir + '-dir'] is not None: key = dir + '-dir'
d = opts['--' + dir + '-dir'][0] if opts['--' + key] is not None:
if dir == 'lib': conf[key] = opts['--' + key][0]
dir += '/ponysay' if (dir == 'share') and (opts['--opt'] is None):
for key in conf: conf[key] += '/ponysay'
if conf[key] not in [None, True, False]: if conf[key].startswith('usr/'):
if conf[key].startswith(prefix + '/' + dir): conf[key] = prefix + conf[key][3:]
conf[key] = d + conf[key][5 + len(dir):]
if opts['--cache-dir'] is not None: if opts['--cache-dir'] is not None:
dir = opts['--cache-dir'][0] dir = opts['--cache-dir'][0]
for key in conf: for key in conf:
@ -1087,7 +1082,6 @@ class Setup():
conf['man-section-' + mansection[0]] = mansection[1] conf['man-section-' + mansection[0]] = mansection[1]
self.destDir = None if opts['--dest-dir'] is None else opts['--dest-dir'][0] self.destDir = None if opts['--dest-dir'] is None else opts['--dest-dir'][0]
return conf return conf

View file

@ -375,7 +375,7 @@ class Backend():
self.output = self.output.replace(AUTO_PUSH, '').replace(AUTO_POP, '') self.output = self.output.replace(AUTO_PUSH, '').replace(AUTO_POP, '')
if self.balloon is not None: if self.balloon is None:
if (self.balloontop > 0) or (self.balloonbottom > 0): if (self.balloontop > 0) or (self.balloonbottom > 0):
self.output = self.output.split('\n') self.output = self.output.split('\n')
self.output = self.output[self.balloontop : ~(self.balloonbottom)] self.output = self.output[self.balloontop : ~(self.balloonbottom)]

View file

@ -45,9 +45,9 @@ class Metadata():
''' '''
@staticmethod @staticmethod
def makeRestrictionLogic(restriction): def makeRestrictionLogic(restriction):
table = [(get_test(cell[:cell.index('=')], table = [(get_test((cell[:cell.index('=')],
cell[cell.index('=') + 1:] cell[cell.index('=') + 1:]
) ))
for cell in clause.lower().replace('_', '').replace(' ', '').split('+')) for cell in clause.lower().replace('_', '').replace(' ', '').split('+'))
for clause in restriction for clause in restriction
] ]

View file

@ -509,7 +509,7 @@ class Ponysay():
ponies = {} ponies = {}
for ponydir in ponydirs: for ponydir in ponydirs:
for pony in Metadata.restrictedPonies(ponydir, logic): for pony in Metadata.restrictedPonies(ponydir, logic):
if (pony not in passed) and (pony in oldponies): if pony in oldponies: # XXX and (pony not in passed)
ponyfile = ponydir + pony + '.pony' ponyfile = ponydir + pony + '.pony'
if oldponies[pony] == ponyfile: if oldponies[pony] == ponyfile:
ponies[pony] = ponyfile ponies[pony] = ponyfile