preperation for spliting into multiple files

Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
Mattias Andrée 2013-04-02 11:11:06 +02:00
parent ae6f0492b4
commit f07349398a
4 changed files with 33 additions and 13 deletions

View file

@ -14,6 +14,7 @@ pv=0 # python version
(hash chmod 2>/dev/null) || (br=1 ; ro=1 ; echo 'Missing chmod, install coreutils [build+runtime required]')
(hash zip 2>/dev/null) || (br=1 ; echo 'Missing zip, install zip [build required]')
(hash gzip 2>/dev/null) || (bo=1 ; echo 'Missing gzip, install gzip [build optional]')
(hash makeinfo 2>/dev/null) || (bo=1 ; echo 'Missing makeinfo, install texinfo [build optional]')

View file

@ -37,6 +37,10 @@ mansections = [('ponysay', '6'),
miscfiles = [('COPYING', '/usr/share/licenses/ponysay/COPYING'),
('CREDITS', '/usr/share/licenses/ponysay/CREDITS')]
ponysaysrc = [src + '.py' for src in
('__main__', 'common', 'ponysay', 'argparser', 'balloon',
'backend', 'colourstack', 'ucs', 'spellocorrecter')]
@ -404,9 +408,10 @@ class Setup():
mane = True
break
if mane:
for src in ponysaysrc:
try:
fileout = open('ponysay.install', 'wb+')
filein = open('ponysay.py', 'rb')
fileout = open('src/%s.install' % src, 'wb+')
filein = open('src/%s' % src, 'rb')
data = filein.read().decode('utf-8', 'replace')
if '#!/usr/bin/env python3' in data:
@ -421,6 +426,19 @@ class Setup():
finally:
if fileout is not None: fileout.close()
if filein is not None: filein .close()
try:
os.chdir('src')
os.system('zip ../ponysay.zip ' + ' '.join(ponysaysrc))
finally:
os.chdir('..')
try:
fileout = open('ponysay.install', 'wb+')
filein = open('src/%s' % src, 'rb')
fileout.write(('#!/usr/bin/env %s\n' % env).encode('utf-8'))
fileout.write(filein.read())
finally:
if fileout is not None: fileout.close()
if filein is not None: filein .close()
for man in manpages:
key = 'man-' + man[0]
@ -721,7 +739,8 @@ class Setup():
def clean(self):
print('\033[1;34m::\033[39mCleaning...\033[21m')
files = ['ponysay.info', 'ponysay.info.gz', 'ponysay.info.xz', 'ponysay.pdf.gz', 'ponysay.pdf.xz', 'ponysay.install']
files = ['ponysay.info', 'ponysay.info.gz', 'ponysay.info.xz', 'ponysay.pdf.gz', 'ponysay.pdf.xz', 'ponysay.install', 'ponysay.zip']
files += ['src/%s.install' % file for file in ponysaysrc]
dirs = ['quotes']
for comp in ['install', 'gz', 'xz']:
for man in manpages: