mirror of
https://github.com/erkin/ponysay
synced 2024-11-15 16:07:59 +00:00
misc fixes
Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
parent
3c583c278f
commit
c38b34a000
4 changed files with 21 additions and 27 deletions
40
setup.py
40
setup.py
|
@ -421,7 +421,7 @@ class Setup():
|
|||
data = data.replace('#!/usr/bin/env python3', '#!/usr/bin/env ' + env)
|
||||
else:
|
||||
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('\nVERSION = \'dev\'', '\nVERSION = \'%s\'' % (PONYSAY_VERSION))
|
||||
|
||||
|
@ -429,14 +429,10 @@ class Setup():
|
|||
finally:
|
||||
if fileout is not None: fileout.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))
|
||||
with ZipFile('../ponysay.zip', 'w') as myzip:
|
||||
for src in ponysaysrc:
|
||||
myzip.write(src)
|
||||
finally:
|
||||
os.chdir('..')
|
||||
print('Creating uncompressed zip file ponysay.zip with files from src: ' + ' '.join(ponysaysrc))
|
||||
with ZipFile('ponysay.zip', 'w') as myzip:
|
||||
for src in ponysaysrc:
|
||||
myzip.write('src/%s.install' % src, src)
|
||||
os.chmod('ponysay.zip', 0o755)
|
||||
try:
|
||||
fileout = open('ponysay.install', 'wb+')
|
||||
|
@ -530,7 +526,7 @@ class Setup():
|
|||
data = data.replace('/usr/bin/ponysay', conf[command])
|
||||
data = data.replace('/ponysay', '\0')
|
||||
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')
|
||||
|
||||
fileout.write(data.encode('utf-8'))
|
||||
|
@ -992,21 +988,20 @@ class Setup():
|
|||
conf['~prefix~'] = prefix
|
||||
|
||||
if opts['--opt'] is not None:
|
||||
if opts['--bin-dir'] is None: opts['--bin-dir'] = ['/opt/ponysay/bin']
|
||||
if opts['--lib-dir'] is None: opts['--lib-dir'] = ['/opt/ponysay/lib']
|
||||
if opts['--libexec-dir'] is None: opts['--libexec-dir'] = ['/opt/ponysay/libexec']
|
||||
if opts['--share-dir'] is None: opts['--share-dir'] = ['/opt/ponysay/share']
|
||||
if opts['--bin-dir'] is None: opts['--bin-dir'] = ['/opt/ponysay']
|
||||
if opts['--lib-dir'] is None: opts['--lib-dir'] = ['/opt/ponysay']
|
||||
if opts['--libexec-dir'] is None: opts['--libexec-dir'] = ['/opt/ponysay']
|
||||
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']
|
||||
|
||||
for dir in ['bin', 'lib', 'libexec', 'share']:
|
||||
if opts['--' + dir + '-dir'] is not None:
|
||||
d = opts['--' + dir + '-dir'][0]
|
||||
if dir == 'lib':
|
||||
dir += '/ponysay'
|
||||
for key in conf:
|
||||
if conf[key] not in [None, True, False]:
|
||||
if conf[key].startswith(prefix + '/' + dir):
|
||||
conf[key] = d + conf[key][5 + len(dir):]
|
||||
key = dir + '-dir'
|
||||
if opts['--' + key] is not None:
|
||||
conf[key] = opts['--' + key][0]
|
||||
if (dir == 'share') and (opts['--opt'] is None):
|
||||
conf[key] += '/ponysay'
|
||||
if conf[key].startswith('usr/'):
|
||||
conf[key] = prefix + conf[key][3:]
|
||||
if opts['--cache-dir'] is not None:
|
||||
dir = opts['--cache-dir'][0]
|
||||
for key in conf:
|
||||
|
@ -1087,7 +1082,6 @@ class Setup():
|
|||
conf['man-section-' + mansection[0]] = mansection[1]
|
||||
|
||||
|
||||
|
||||
self.destDir = None if opts['--dest-dir'] is None else opts['--dest-dir'][0]
|
||||
|
||||
return conf
|
||||
|
|
|
@ -375,7 +375,7 @@ class Backend():
|
|||
|
||||
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):
|
||||
self.output = self.output.split('\n')
|
||||
self.output = self.output[self.balloontop : ~(self.balloonbottom)]
|
||||
|
|
|
@ -45,9 +45,9 @@ class Metadata():
|
|||
'''
|
||||
@staticmethod
|
||||
def makeRestrictionLogic(restriction):
|
||||
table = [(get_test(cell[:cell.index('=')],
|
||||
table = [(get_test((cell[:cell.index('=')],
|
||||
cell[cell.index('=') + 1:]
|
||||
)
|
||||
))
|
||||
for cell in clause.lower().replace('_', '').replace(' ', '').split('+'))
|
||||
for clause in restriction
|
||||
]
|
||||
|
|
|
@ -509,7 +509,7 @@ class Ponysay():
|
|||
ponies = {}
|
||||
for ponydir in ponydirs:
|
||||
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'
|
||||
if oldponies[pony] == ponyfile:
|
||||
ponies[pony] = ponyfile
|
||||
|
|
Loading…
Reference in a new issue