mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 22:07:58 +01:00
setup option --freedom added
This commit is contained in:
parent
b38cdb9a5d
commit
2135cc9daa
3 changed files with 54 additions and 7 deletions
|
@ -31,6 +31,8 @@ Version 3.0
|
||||||
|
|
||||||
Setup option --sysconf-dir with default value /etc added.
|
Setup option --sysconf-dir with default value /etc added.
|
||||||
|
|
||||||
|
Setup option --freedom with default value sloppy added.
|
||||||
|
|
||||||
|
|
||||||
Version 2.9.1
|
Version 2.9.1
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
@documentlanguage en
|
@documentlanguage en
|
||||||
@finalout
|
@finalout
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
@set VERSION 2.9.1
|
@set VERSION 3.0
|
||||||
|
|
||||||
@defindex op
|
@defindex op
|
||||||
@synindex op vr
|
@synindex op vr
|
||||||
|
@ -48,7 +48,7 @@ Texts. A copy of the license is included in the section entitled
|
||||||
@c ** start of front page image **
|
@c ** start of front page image **
|
||||||
@c If print make a pdf or hard copy with the front cover
|
@c If print make a pdf or hard copy with the front cover
|
||||||
@c you may or may not want to remove this.
|
@c you may or may not want to remove this.
|
||||||
@image{infoimage,423.5px}
|
@c @image{infoimage,423.5px}
|
||||||
@c ** end of front page image **
|
@c ** end of front page image **
|
||||||
@author by Mattias Andrée (maandree)
|
@author by Mattias Andrée (maandree)
|
||||||
|
|
||||||
|
@ -1903,6 +1903,15 @@ Recognised arguments are @code{copy}, @code{hard} and @code{symbolic}.
|
||||||
@command{ponysay -L} will give the same output as @command{ponysay -l} if @code{copy}
|
@command{ponysay -L} will give the same output as @command{ponysay -l} if @code{copy}
|
||||||
or @code{hard} is used. This is because it does link reading and not content or
|
or @code{hard} is used. This is because it does link reading and not content or
|
||||||
inode comparison.
|
inode comparison.
|
||||||
|
|
||||||
|
@item --freedom=sloppy
|
||||||
|
@opindex @option{--freedom}
|
||||||
|
@cindex full freedom
|
||||||
|
@cindex freedom, full
|
||||||
|
Set your freedom. If you the any of the values @code{strict}, @code{full} or @code{yes},
|
||||||
|
the setup will make sure that only completly free parts of the package is installed.
|
||||||
|
This should be used (@code{--freedom=strict}) on distributions for GNU endorsed (endorsable)
|
||||||
|
GNU/Linux-libre distributions.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
Recognised compressions are @option{gz} which uses @option{gzip -9}, and @option{xz}
|
Recognised compressions are @option{gz} which uses @option{gzip -9}, and @option{xz}
|
||||||
|
@ -2686,7 +2695,9 @@ Balloons can be have and explicit minimum column span with placement justificati
|
||||||
Only ponies that fit the terminal will be randomly selected (for directory with pony
|
Only ponies that fit the terminal will be randomly selected (for directory with pony
|
||||||
dimension files generated), however if no pony fits, any of the can be randomly selected.
|
dimension files generated), however if no pony fits, any of the can be randomly selected.
|
||||||
@item
|
@item
|
||||||
Setup option @option{--sysconf-dir} with default value @file{/etc} added
|
Setup option @option{--sysconf-dir} with default value @file{/etc} added,
|
||||||
|
@item
|
||||||
|
Setup option @option{--freedom} with default value @code{sloppy} added,
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
|
|
42
setup.py
42
setup.py
|
@ -234,6 +234,10 @@ class Setup():
|
||||||
alternatives = ['--linking'], arg='TYPE')
|
alternatives = ['--linking'], arg='TYPE')
|
||||||
|
|
||||||
|
|
||||||
|
opts.add_argumented (help = 'Do only install fully free parts of the pacakge\nDefault = sloppy, use strict, full or yes if you want to do this',
|
||||||
|
alternatives = ['--freedom'], arg='FREEDOM')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
opts.parse()
|
opts.parse()
|
||||||
|
|
||||||
|
@ -243,6 +247,12 @@ class Setup():
|
||||||
self.linking = opts.opts['--linking'][0]
|
self.linking = opts.opts['--linking'][0]
|
||||||
|
|
||||||
|
|
||||||
|
self.free = False
|
||||||
|
if opts.opts['--freedom'] is not None:
|
||||||
|
if opts.opts['--freedom'][0].lower() in ('strict', 'full', 'yes'):
|
||||||
|
self.free = True
|
||||||
|
|
||||||
|
|
||||||
if (opts.opts['---DESTDIR'] is not None) and (opts.opts['--dest-dir'] is None):
|
if (opts.opts['---DESTDIR'] is not None) and (opts.opts['--dest-dir'] is None):
|
||||||
destdir = opts.opts['---DESTDIR'][0]
|
destdir = opts.opts['---DESTDIR'][0]
|
||||||
if len(destdir) > 0:
|
if len(destdir) > 0:
|
||||||
|
@ -336,6 +346,8 @@ class Setup():
|
||||||
for miscfile in miscfiles: print(GREEN % ('Installing ' + miscfile[0] + ' to ', conf[miscfile[0]]))
|
for miscfile in miscfiles: print(GREEN % ('Installing ' + miscfile[0] + ' to ', conf[miscfile[0]]))
|
||||||
print('Using system configuration directory: ' + conf['sysconf-dir'])
|
print('Using system configuration directory: ' + conf['sysconf-dir'])
|
||||||
print('Prefered linking style: ' + self.linking)
|
print('Prefered linking style: ' + self.linking)
|
||||||
|
if self.free: print(GREEN % ('', 'Installing only fully free parts of the package'))
|
||||||
|
else: print(RED % ('Installing \033[1mnot\033[21m only fully free parts of the package'))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
@ -592,12 +604,12 @@ class Setup():
|
||||||
self.cp(False, src, dests)
|
self.cp(False, src, dests)
|
||||||
for dir in sharedirs:
|
for dir in sharedirs:
|
||||||
if conf[dir[0]] is not None:
|
if conf[dir[0]] is not None:
|
||||||
self.cp(True, dir[0], [conf[dir[0]]])
|
self.cp(True, dir[0], [conf[dir[0]]], self.validateFreedom if self.free else None)
|
||||||
for file in sharefiles:
|
for file in sharefiles:
|
||||||
if conf[file[0]] is not None:
|
if conf[file[0]] is not None:
|
||||||
self.cp(False, 'share/' + file[1], [conf[file[0]]])
|
self.cp(False, 'share/' + file[1], [conf[file[0]]], self.validateFreedom if self.free else None)
|
||||||
for file in miscfiles:
|
for file in miscfiles:
|
||||||
self.cp(False, file[0], [conf[file[0]]])
|
self.cp(False, file[0], [conf[file[0]]], self.validateFreedom if self.free else None)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
@ -752,10 +764,32 @@ class Setup():
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
Check whethera file is fully free
|
||||||
|
'''
|
||||||
|
def validateFreedom(self, filename):
|
||||||
|
if filename.endswith('.pony') and not (filename == '.pony'):
|
||||||
|
with open(filename, 'rb') as file:
|
||||||
|
data = file.read.decode('utf8', 'replace')
|
||||||
|
if data.startswith('$$$\n') and ('\n$$$\n' in data):
|
||||||
|
data = data[4 : data.find('\n$$$\n')].split('\n')
|
||||||
|
for line in data:
|
||||||
|
if ':' not in line:
|
||||||
|
continue
|
||||||
|
line = [item.strip() for item in line.split(':')]
|
||||||
|
if (len(line) == 2) and (line[0] == 'FREE'):
|
||||||
|
return line[1].lower() == 'yes'
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Copys a files or directory to multiple destinations
|
Copys a files or directory to multiple destinations
|
||||||
'''
|
'''
|
||||||
def cp(self, recursive, source, destinations):
|
def cp(self, recursive, source, destinations, validatehook = None):
|
||||||
|
if validatehook is not None:
|
||||||
|
if not validatehook(source):
|
||||||
|
print('Ignoring installation of file %s (did not pass validation process made by setup settings)' % source)
|
||||||
if os.path.islink(source) and (self.linking != COPY) and os.path.isdir(os.path.realpath(source)):
|
if os.path.islink(source) and (self.linking != COPY) and os.path.isdir(os.path.realpath(source)):
|
||||||
target = os.readlink(source)
|
target = os.readlink(source)
|
||||||
for dest in destinations:
|
for dest in destinations:
|
||||||
|
|
Loading…
Reference in a new issue