actionsapi/texlivemodules.py: Fixes logical false result, using shlex for better parsing"
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
import shlex
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
_ = __trans.ugettext
|
_ = __trans.ugettext
|
||||||
@@ -146,16 +146,16 @@ def installConfigFiles():
|
|||||||
def handleConfigFiles():
|
def handleConfigFiles():
|
||||||
'''Handling config files'''
|
'''Handling config files'''
|
||||||
for root, dirs,files in os.walk("%s/usr/share/texmf" % get.installDIR()):
|
for root, dirs,files in os.walk("%s/usr/share/texmf" % get.installDIR()):
|
||||||
for file in files:
|
if not ("config" in root or "doc" in root):
|
||||||
if file.endswith("cnf") or file.endswith("cfg"):
|
for configFile in files:
|
||||||
if not ("config" and "doc") in root:
|
if configFile.endswith(("cfg", "cnf")):
|
||||||
dirname = root.split("/")[-1]
|
dirname = root.split("/")[-1]
|
||||||
if not os.path.isdir("%s/etc/texmf/%s.d" % (get.installDIR(),dirname)):
|
if not os.path.isdir("%s/etc/texmf/%s.d" % (get.installDIR(),dirname)):
|
||||||
ctx.ui.info(_('Creating /etc/texmf/%s.d') % dirname)
|
ctx.ui.info(_('Creating /etc/texmf/%s.d') % dirname)
|
||||||
dodir("/etc/texmf/%s.d" % dirname)
|
dodir("/etc/texmf/%s.d" % dirname)
|
||||||
ctx.ui.info(_('Moving (and symlinking) /usr/share/texmf/%s to /etc/texmf/%s.d') % (file,dirname))
|
ctx.ui.info(_('Moving (and symlinking) /usr/share/texmf/%s to /etc/texmf/%s.d') % (configFile,dirname))
|
||||||
domove("/usr/share/texmf/%s/%s" % (dirname,file), "/etc/texmf/%s.d" % dirname)
|
domove("/usr/share/texmf/%s/%s" % (dirname,configFile), "/etc/texmf/%s.d" % dirname)
|
||||||
dosym("/etc/texmf/%s.d/%s" % (dirname, file), "/usr/share/texmf/%s/%s" %(dirname, file))
|
dosym("/etc/texmf/%s.d/%s" % (dirname, configFile), "/usr/share/texmf/%s/%s" %(dirname, configFile))
|
||||||
|
|
||||||
|
|
||||||
def addFormat(parameters):
|
def addFormat(parameters):
|
||||||
@@ -170,7 +170,7 @@ def addFormat(parameters):
|
|||||||
# TODO: Use regex for code simplification
|
# TODO: Use regex for code simplification
|
||||||
|
|
||||||
parameters = " ".join(parameters.split()) # Removing white-space characters
|
parameters = " ".join(parameters.split()) # Removing white-space characters
|
||||||
parameters = parameters.split(" ",3) # Split parameters until the value "option"
|
parameters = shlex.split(parameters) # Split parameters until the value "option"
|
||||||
para_dict = {}
|
para_dict = {}
|
||||||
for option in parameters:
|
for option in parameters:
|
||||||
pair = option.strip() # Remove whitespaces before "options" value
|
pair = option.strip() # Remove whitespaces before "options" value
|
||||||
|
|||||||
Reference in New Issue
Block a user