mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-28 15:07:59 +01:00
fix ponysay-tool --kms
Signed-off-by: Mattias Andrée <maandree@operamail.com>
This commit is contained in:
parent
e9c4b63ac7
commit
34d0b21b12
3 changed files with 17 additions and 6 deletions
4
setup.py
4
setup.py
|
@ -601,8 +601,8 @@ class Setup():
|
||||||
os.makedirs(pdir)
|
os.makedirs(pdir)
|
||||||
print('Creating directory ' + dir)
|
print('Creating directory ' + dir)
|
||||||
os.mkdir(dir)
|
os.mkdir(dir)
|
||||||
print('Setting permission mode mask for ' + dir + ' to 6777')
|
print('Setting permission mode mask for ' + dir + ' to 7777')
|
||||||
Popen('chmod -R 6777 -- \'' + dir.replace('\'', '\'\\\'\'') + '\'', shell=True).wait()
|
Popen('chmod -R 7777 -- \'' + dir.replace('\'', '\'\\\'\'') + '\'', shell=True).wait()
|
||||||
print('Setting group for ' + dir + ' users')
|
print('Setting group for ' + dir + ' users')
|
||||||
Popen('chown -R :users -- \'' + dir.replace('\'', '\'\\\'\'') + '\'', shell=True).wait()
|
Popen('chown -R :users -- \'' + dir.replace('\'', '\'\\\'\'') + '\'', shell=True).wait()
|
||||||
for shell in [item[0] for item in shells]:
|
for shell in [item[0] for item in shells]:
|
||||||
|
|
12
src/kms.py
12
src/kms.py
|
@ -128,7 +128,10 @@ class KMS():
|
||||||
with open(cachedir + '/.version', 'w+') as cachev:
|
with open(cachedir + '/.version', 'w+') as cachev:
|
||||||
cachev.write(KMS_VERSION)
|
cachev.write(KMS_VERSION)
|
||||||
if shared:
|
if shared:
|
||||||
os.chmod(_cachedir + '/.version', 0o666)
|
try:
|
||||||
|
os.chmod(cachedir + '/.version', 0o666)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
## Get kmspony directory and kmspony file
|
## Get kmspony directory and kmspony file
|
||||||
kmsponies = cachedir + '/kmsponies/' + palettefile
|
kmsponies = cachedir + '/kmsponies/' + palettefile
|
||||||
|
@ -147,14 +150,17 @@ class KMS():
|
||||||
if not os.path.isdir(kmsponydir):
|
if not os.path.isdir(kmsponydir):
|
||||||
os.makedirs(kmsponydir)
|
os.makedirs(kmsponydir)
|
||||||
if shared:
|
if shared:
|
||||||
Popen('chmod -R 6777 -- ' + _cachedir, shell=True).wait()
|
Popen('chmod -R 7777 -- ' + _cachedir, shell=True).wait()
|
||||||
ponytoolcmd = 'ponytool --import ponysay --file %s --export ponysay --file %s --platform linux '
|
ponytoolcmd = 'ponytool --import ponysay --file %s --export ponysay --file %s --platform linux '
|
||||||
ponytoolcmd += '--balloon n --colourful y --fullcolour y --left - --right - --top - --bottom - --palette %s'
|
ponytoolcmd += '--balloon n --colourful y --fullcolour y --left - --right - --top - --bottom - --palette %s'
|
||||||
if not os.system(ponytoolcmd % (_pony, _kmspony, palette)) == 0:
|
if not os.system(ponytoolcmd % (_pony, _kmspony, palette)) == 0:
|
||||||
printerr('Unable to run ponytool successfully, you need util-say>=3 for KMS support')
|
printerr('Unable to run ponytool successfully, you need util-say>=3 for KMS support')
|
||||||
exit(1)
|
exit(1)
|
||||||
if shared:
|
if shared:
|
||||||
os.chmod(_kmspony, 0o666)
|
try:
|
||||||
|
os.chmod(kmspony, 0o666)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return kmspony
|
return kmspony
|
||||||
|
|
||||||
|
|
|
@ -438,7 +438,7 @@ class PonysayTool():
|
||||||
class PhonyArgParser():
|
class PhonyArgParser():
|
||||||
def __init__(self, key, value):
|
def __init__(self, key, value):
|
||||||
self.argcount = 3
|
self.argcount = 3
|
||||||
self.message = ponyfile
|
self.message = ''
|
||||||
self.opts = self
|
self.opts = self
|
||||||
self.key = key
|
self.key = key
|
||||||
self.value = value
|
self.value = value
|
||||||
|
@ -464,6 +464,8 @@ class PonysayTool():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
term = os.environ['TERM']
|
||||||
|
os.environ['TERM'] = 'linux'
|
||||||
|
|
||||||
sys.stdout = StringInputStream()
|
sys.stdout = StringInputStream()
|
||||||
ponysay = Ponysay()
|
ponysay = Ponysay()
|
||||||
|
@ -477,16 +479,19 @@ class PonysayTool():
|
||||||
|
|
||||||
for pony in stdponies:
|
for pony in stdponies:
|
||||||
printerr('Genering standard kmspony: %s' % pony)
|
printerr('Genering standard kmspony: %s' % pony)
|
||||||
|
sys.stderr.buffer.flush();
|
||||||
sys.stdout = StringInputStream()
|
sys.stdout = StringInputStream()
|
||||||
ponysay = Ponysay()
|
ponysay = Ponysay()
|
||||||
ponysay.run(PhonyArgParser('--pony', pony))
|
ponysay.run(PhonyArgParser('--pony', pony))
|
||||||
|
|
||||||
for pony in extraponies:
|
for pony in extraponies:
|
||||||
printerr('Genering extra kmspony: %s' % pony)
|
printerr('Genering extra kmspony: %s' % pony)
|
||||||
|
sys.stderr.buffer.flush();
|
||||||
sys.stdout = StringInputStream()
|
sys.stdout = StringInputStream()
|
||||||
ponysay = Ponysay()
|
ponysay = Ponysay()
|
||||||
ponysay.run(PhonyArgParser('++pony', pony))
|
ponysay.run(PhonyArgParser('++pony', pony))
|
||||||
|
|
||||||
|
os.environ['TERM'] = term
|
||||||
sys.stdout = stdout
|
sys.stdout = stdout
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue