Kaydet (Commit) 4ef7ce70 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Format yuzunden meydana gelen ve gelebilecek butun buglar fixe edildi

üst 4805bfff
......@@ -45,7 +45,7 @@ import inary.context as ctx
def init_logging():
log_dir = os.path.join(ctx.config.dest_dir(), ctx.config.log_dir())
if os.access(log_dir, os.W_OK) and "distutils.core" not in sys.modules:
handler = logging.handlers.RotatingFileHandler('%s/inary.log' % log_dir)
handler = logging.handlers.RotatingFileHandler('{}/inary.log'.format(log_dir))
formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s %(message)s')
handler.setFormatter(formatter)
ctx.log = logging.getLogger('inary')
......
......@@ -9,10 +9,10 @@ available operations:
add("param1", "param2", ..., "paramN")
e.g.
inarytools.cxxflags.add("-fpermisive")
-> shelltools.export("CXXFLAGS", "%s -fpermisive" % get.CXXFLAGS())
-> shelltools.export("CXXFLAGS", "{} -fpermisive".format(get.CXXFLAGS()))
inarytools.flags.add("-fno-strict-aliasing", "-fPIC")
-> shelltools.export("CFLAGS", "%s -fno-strict-aliasing -fPIC" % get.CFLAGS())
-> shelltools.export("CXXFLAGS", "%s -ffno-strict-aliasing -fPIC" % get.CXXFLAGS())
-> shelltools.export("CFLAGS", "{} -fno-strict-aliasing -fPIC".format(get.CFLAGS()))
-> shelltools.export("CXXFLAGS", "{} -ffno-strict-aliasing -fPIC".format(get.CXXFLAGS()))
remove("param1", "param2", ..., "paramN")
e.g.
......
......@@ -116,24 +116,22 @@ def fixpc():
def install(parameters = '', argument = 'install'):
'''install source into install directory with given parameters'''
args = 'make prefix=%(prefix)s/%(defaultprefix)s \
datadir=%(prefix)s/%(data)s \
infodir=%(prefix)s/%(info)s \
localstatedir=%(prefix)s/%(localstate)s \
mandir=%(prefix)s/%(man)s \
sysconfdir=%(prefix)s/%(conf)s \
%(parameters)s \
%(argument)s' % {
'prefix': get.installDIR(),
'defaultprefix': get.defaultprefixDIR(),
'man': get.manDIR(),
'info': get.infoDIR(),
'localstate': get.localstateDIR(),
'conf': get.confDIR(),
'data': get.dataDIR(),
'parameters': parameters,
'argument':argument,
}
args = 'make prefix={0}/{1} \
datadir={0}/{2} \
infodir={0}/{3} \
localstatedir={0}/{4} \
mandir={0}/{5} \
sysconfdir={0}/{6} \
{7} \
{8}'.format(get.installDIR(),
get.defaultprefixDIR(),
get.dataDIR(),
get.infoDIR(),
get.localstateDIR(),
get.manDIR(),
get.confDIR(),
parameters,
argument )
if system(args):
raise InstallError(_('Install failed.'))
......@@ -145,7 +143,7 @@ def install(parameters = '', argument = 'install'):
if isDirectory("{}/emul32".format(get.installDIR())): removeDir("/emul32")
def rawInstall(parameters = '', argument = 'install'):
'''install source into install directory with given parameters = PREFIX=%s % get.installDIR()'''
'''install source into install directory with given parameters = PREFIX=get.installDIR()'''
if system('make {0} {1}'.format(parameters, argument)):
raise InstallError(_('Install failed.'))
else:
......
......@@ -86,13 +86,11 @@ def install(parameters = '', argument = 'install'):
'''install source into install directory with given parameters'''
# You can't squeeze unix paths with things like 'bindir', 'datadir', etc with CMake
# http://public.kitware.com/pipermail/cmake/2006-August/010748.html
args = 'make DESTDIR="%(destdir)s" \
%(parameters)s \
%(argument)s' % {
'destdir' : get.installDIR(),
'parameters' : parameters,
'argument' : argument,
}
args = 'make DESTDIR="{0}" \
{1} \
{2}'.format(get.installDIR(),
parameters,
argument)
if system(args):
raise InstallError(_('Install failed.'))
......@@ -100,9 +98,9 @@ def install(parameters = '', argument = 'install'):
fixInfoDir()
def rawInstall(parameters = '', argument = 'install'):
'''install source into install directory with given parameters = PREFIX=%s % get.installDIR()'''
'''install source into install directory with given parameters = PREFIX=get.installDIR()'''
if can_access_file('makefile') or can_access_file('Makefile') or can_access_file('GNUmakefile'):
if system('make {} {} '.format(parameters, argument)):
if system('make {0} {1} '.format(parameters, argument)):
raise InstallError(_('Install failed.'))
else:
fixInfoDir()
......
......@@ -77,7 +77,7 @@ def dohtml(*sourceFiles, **kw):
for sourceFile in sourceFiles:
sourceFileGlob = glob.glob(sourceFile)
if len(sourceFileGlob) == 0:
raise FileError(_("No file matched pattern \"{}\"") % sourceFile)
raise FileError(_("No file matched pattern \"{}\"").format(sourceFile))
for source in sourceFileGlob:
if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions:
......@@ -149,7 +149,7 @@ def doman(*sourceFiles):
manPDIR = join_path(manDIR, '/man{}'.format(pageDirectory))
makedirs(manPDIR)
if not compressed:
system('install -m0644 {} {}'.format(source, manPDIR))
system('install -m0644 {0} {1}'.format(source, manPDIR))
else:
uncompress(compressed, targetDir=manPDIR)
......
......@@ -85,4 +85,4 @@ def lib_insinto(sourceFile, destinationDirectory, permission = 0o644):
if os.path.islink(sourceFile):
os.symlink(os.path.realpath(sourceFile), os.path.join(destinationDirectory, sourceFile))
else:
system('install -m0%o %s %s' % (permission, sourceFile, destinationDirectory))
system('install -m0{0} {1} {2}'.format(permission, sourceFile, destinationDirectory))
......@@ -49,17 +49,17 @@ def configure(parameters = ''):
''' parameters = '--with-nls --with-libusb --with-something-usefull '''
if can_access_file('configure'):
args = './configure \
--prefix={0.kdeDIR()} \
--build={0.HOST()} \
--prefix={0} \
--build={1} \
--with-x \
--enable-mitshm \
--with-xinerama \
--with-qt-dir={0.qtDIR()} \
--with-qt-dir={2} \
--enable-mt \
--with-qt-libraries={0.qtDIR}/lib \
--with-qt-libraries={2}/lib \
--disable-dependency-tracking \
--disable-debug \
{1}'.format(get, parameters)
{3}'.format(get.kdeDIR(), get.HOST(), get.qtDIR(), parameters)
if system(args):
raise ConfigureError(_('Configure failed.'))
......
......@@ -23,7 +23,7 @@ modulesdir = "{0}/{1}".format(libdir, basename)
libexecdir = "{}/libexec".format(modulesdir)
iconsdir = "{}/share/icons".format(prefix)
applicationsdir = "{0}/share/applications/{1}".format(prefix, basename)
mandir = "/{}" % get.manDIR()
mandir = "/{}".format(get.manDIR())
sharedir = "{0}/share/{1}".format(prefix, basename)
appsdir = "{}/apps".format(sharedir)
configdir = "{}/config".format(sharedir)
......
......@@ -16,28 +16,28 @@ from inary.actionsapi import shelltools
basename = "kde5"
prefix = "/%s" % get.defaultprefixDIR()
libdir = "%s/lib" % prefix
bindir = "%s/bin" % prefix
libexecdir = "%s/lib" % prefix
iconsdir = "%s/share/icons" % prefix
applicationsdir = "%s/share/applications/%s" % (prefix, basename)
mandir = "/%s" % get.manDIR()
sharedir = "%s/share" % prefix
localedir = "%s/share/locale" % prefix
qmldir = "%s/lib/qt5/qml" % prefix
plugindir = "%s/lib/qt5/plugins" % prefix
moduledir = "%s/lib/qt5/mkspecs/modules" % prefix
pythondir = "%s/bin/python" % prefix
appsdir = "%s" % sharedir
prefix = "/{}".format(get.defaultprefixDIR())
libdir = "{}/lib".format(prefix)
bindir = "{}/bin".format(prefix)
libexecdir = "{}/lib".format(prefix)
iconsdir = "{}/share/icons".format(prefix)
applicationsdir = "{0}/share/applications/{1}".format(prefix, basename)
mandir = "/{}".format(get.manDIR())
sharedir = "{}/share".format(prefix)
localedir = "{}/share/locale".format(prefix)
qmldir = "{}/lib/qt5/qml".format(prefix)
plugindir = "{}/lib/qt5/plugins".format(prefix)
moduledir = "{}/lib/qt5/mkspecs/modules".format(prefix)
pythondir = "{}/bin/python".format(prefix)
appsdir = "{}".format(sharedir)
sysconfdir= "/etc"
configdir = "%s/xdg" % sysconfdir
servicesdir = "%s/services" % sharedir
servicetypesdir = "%s/servicetypes" % sharedir
includedir = "%s/include" % prefix
docdir = "/%s/%s" % (get.docDIR(), basename)
htmldir = "%s/html" % docdir
wallpapersdir = "%s/share/wallpapers" % prefix
configdir = "{}/xdg".format(sysconfdir)
servicesdir = "{}/services".format(sharedir)
servicetypesdir = "{}/servicetypes".format(sharedir)
includedir = "{}/include".format(prefix)
docdir = "/{0}/{1}".format(get.docDIR(), basename)
htmldir = "{}/html".format(docdir)
wallpapersdir = "{}/share/wallpapers".format(prefix)
def configure(parameters = '', installPrefix = prefix, sourceDir = '..'):
''' parameters -DLIB_INSTALL_DIR="hede" -DSOMETHING_USEFUL=1'''
......@@ -46,23 +46,23 @@ def configure(parameters = '', installPrefix = prefix, sourceDir = '..'):
shelltools.cd("build")
cmaketools.configure("-DCMAKE_BUILD_TYPE=Release \
-DKDE_INSTALL_LIBEXECDIR=%s \
-DKDE_INSTALL_LIBEXECDIR={0} \
-DCMAKE_INSTALL_LIBDIR=lib \
-DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
-DKDE_INSTALL_QMLDIR=%s \
-DKDE_INSTALL_SYSCONFDIR=%s \
-DKDE_INSTALL_PLUGINDIR=%s \
-DECM_MKSPECS_INSTALL_DIR=%s \
-DKDE_INSTALL_QMLDIR={1} \
-DKDE_INSTALL_SYSCONFDIR={2} \
-DKDE_INSTALL_PLUGINDIR={3} \
-DECM_MKSPECS_INSTALL_DIR={4} \
-DBUILD_TESTING=OFF \
-DKDE_INSTALL_LIBDIR=lib \
-Wno-dev \
-DCMAKE_INSTALL_PREFIX=%s" % (libexecdir, qmldir, sysconfdir, plugindir, moduledir, prefix), installPrefix, sourceDir)
-DCMAKE_INSTALL_PREFIX={5}".format(libexecdir, qmldir, sysconfdir, plugindir, moduledir, prefix), installPrefix, sourceDir)
shelltools.cd("..")
def make(parameters = ''):
cmaketools.make('-C build %s' % parameters)
cmaketools.make('-C build {}'.format(parameters))
def install(parameters = '', argument = 'install'):
cmaketools.install('-C build %s' % parameters, argument)
cmaketools.install('-C build {}'.format(parameters), argument)
......@@ -36,18 +36,18 @@ includedir = "{}/include".format(prefix)
# qt5 spesific variables
headerdir = "{}/include/{}".format(prefix, basename)
datadir = "{}/share/{}".format(prefix, basename)
docdir = "/{}/{}".format(get.docDIR(), basename)
archdatadir = "{}/{}".format(libdir, basename)
examplesdir = "{}/{}/examples".format(libdir, basename)
importdir = "{}/{}/imports".format(libdir, basename)
plugindir = "{}/{}/plugins".format(libdir, basename)
qmldir = "{}/{}/qmldir".format(libdir, basename)
testdir = "{}/share/{}".format(prefix, basename)
translationdir = "{}/translations".format(datadir)
qmake = "{}/qmake-qt5" % bindir
headerdir = "{0}/include/{1}".format(prefix, basename)
datadir = "{0}/share/{1}".format(prefix, basename)
docdir = "/{0}/{1}".format(get.docDIR(), basename)
archdatadir = "{0}/{1}".format(libdir, basename)
examplesdir = "{0}/{1}/examples".format(libdir, basename)
importdir = "{0}/{1}/imports".format(libdir, basename)
plugindir = "{0}/{1}/plugins".format(libdir, basename)
qmldir = "{0}/{1}/qmldir".format(libdir, basename)
testdir = "{0}/share/{1}".format(prefix, basename)
translationdir = "{0}/translations".format(datadir)
qmake = "{}/qmake-qt5".format(bindir)
class ConfigureError(inary.actionsapi.Error):
def __init__(self, value=''):
......@@ -63,7 +63,7 @@ def configure(projectfile='', parameters='', installPrefix=prefix):
if len(profiles) > 1 and projectfile == '':
raise ConfigureError(_("It seems there are more than one .pro file, you must specify one. (Possible .pro files: {})").format(", ".join(profiles)))
shelltools.system("{0} -makefile {1} PREFIX='{2}' QMAKE_CFLAGS+='{3.CFLAGS()}' QMAKE_CXXFLAGS+='{3.CXXFLAGS()}' {5}".format(qmake, projectfile, installPrefix, get, parameters))
shelltools.system("{0} -makefile {1} PREFIX='{2}' QMAKE_CFLAGS+='{3}' QMAKE_CXXFLAGS+='{4}' {5}".format(qmake, projectfile, installPrefix, get.CFLAGS(), get.CXXFLAGS(), parameters))
def make(parameters=''):
cmaketools.make(parameters)
......
......@@ -67,7 +67,7 @@ def chmod(filePath, mode = 0o755):
try:
os.chmod(fileName, mode)
except OSError:
ctx.ui.error(_('ActionsAPI [chmod]: Operation not permitted: %s (mode: 0%o)') % (fileName, mode))
ctx.ui.error(_('ActionsAPI [chmod]: Operation not permitted: {0} (mode: 0{1})').format(fileName, mode))
else:
ctx.ui.error(_('ActionsAPI [chmod]: File {} doesn\'t exists.').format(fileName))
......
......@@ -179,8 +179,8 @@ def addFormat(parameters):
elif not pair[0] == 'patterns':
para_dict["patterns"] = '-'
cnf_file = open('{0.curDIR()}/texmf/fmtutil/format.{0.srcNAME()}.cnf'.format(get), 'a')
cnf_file.write('{0["name"]}\t{0["engine"]}\t{0["patterns"]}\t{0["options"]}\n'.format(para_dict))
cnf_file = open('{0}/texmf/fmtutil/format.{1}.cnf'.format(get.curDIR(), get.srcNAME()), 'a')
cnf_file.write('{0[name]}\t{0[engine]}\t{0[patterns]}\t{0[options]}\n'.format(para_dict))
cnf_file.close()
def moveSources():
......@@ -217,12 +217,12 @@ def addLanguageDat(parameter):
if len(pair) == 2: #That's just a caution, the pair should have two items, not more not less
para_dict[pair[0]] = pair[1]
language_dat = open('{0.curDIR()}/language.{0.srcNAME()}.dat'.format(get) , 'a')
language_dat.write('{0["name"]}\t{0["file"]}\n"'.format(para_dict))
language_dat = open('{0}/language.{1}.dat'.format(get.curDIR(), get.srcNAME()) , 'a')
language_dat.write('{0[name]}\t{0[file]}\n"'.format(para_dict))
language_dat.close()
if "synonyms" in para_dict:
language_dat = open('{0.curDIR()}/language.{0.srcNAME()}.dat'.format(get) , 'a')
language_dat = open('{0}/language.{1}.dat'.format(get.curDIR(),get.srcNAME()) , 'a')
language_dat.write("={}\n".format(para_dict["synonyms"]))
language_dat.close()
......@@ -240,18 +240,18 @@ def addLanguageDef(parameter):
if "righthyphenmin" in para_dict and not para_dict["righthyphenmin"]:
para_dict["righthyphenmin"] = "3"
language_def = open('%s/language.%s.def' % (get.curDIR(),get.srcNAME()) , 'a')
language_def = open('{0}/language.{1}.def'.format(get.curDIR(),get.srcNAME()) , 'a')
language_def.write("\\addlanguage{%s}{%s}{}{%s}{%s}\n" % (para_dict["name"], para_dict["file"], para_dict["lefthyphenmin"], para_dict["righthyphenmin"]))
language_def.close()
if "synonyms" in para_dict:
language_def = open('%s/language.%s.def' % (get.curDIR(),get.srcNAME()) , 'a')
language_def = open('{0}/language.{1}.def'.format(get.curDIR(),get.srcNAME()) , 'a')
language_def.write("\\addlanguage{%s}{%s}{}{%s}{%s}\n" % (para_dict["synonyms"], para_dict["file"], para_dict["lefthyphenmin"], para_dict["righthyphenmin"]))
language_def.close()
def generateConfigFiles():
'''Generate config files'''
for tlpobjfile in ls("%s/tlpkg/tlpobj/*" % get.curDIR()):
for tlpobjfile in ls("{}/tlpkg/tlpobj/*".format(get.curDIR())):
jobsfile=open(tlpobjfile, "r")
for line in jobsfile.readlines():
splitline = line.split(" ", 2)
......
......@@ -360,7 +360,7 @@ class ArchiveTar(ArchiveBase):
for service in ("NetworkManager", "connman", "wicd"):
if os.path.isfile("/etc/scom/services/enabled/{}".format(service)):
startservices.append(service)
os.system("service % stop" % service)
os.system("service {} stop".format(service))
os.system("service dbus stop")
break
os.system("mv -f {0} {0}.old".format(tarinfo.name))
......
......@@ -164,9 +164,9 @@ class Build(command.Command, metaclass=command.autocommand):
ctx.ui.info(_("Supported package formats:"))
for format in inary.package.Package.formats:
if format == inary.package.Package.default_format:
ctx.ui.info(_(" {} (default)") % format)
ctx.ui.info(_(" {} (default)").format(format))
else:
ctx.ui.info(" {}" % format)
ctx.ui.info(" {}".format(format))
return
self.init()
......
......@@ -45,7 +45,7 @@ class Maintainer(xmlfile.XmlFile, metaclass=autoxml.autoxml):
t_Email = [autoxml.String, autoxml.mandatory]
def __str__(self):
s = "{} <{}>".format(self.name, self.email)
s = "{0} <{1}>".format(self.name, self.email)
return s
class Component(xmlfile.XmlFile, metaclass=autoxml.autoxml):
......
......@@ -100,7 +100,7 @@ class History(xmlfile.XmlFile, metaclass=autoxml.autoxml):
raise Exception(_("Unknown package operation"))
opno = self._get_latest()
self.histfile = "{}_{}.xml".format(opno, operation)
self.histfile = "{0}_{1}.xml".format(opno, operation)
year, month, day, hour, minute = time.localtime()[0:5]
self.operation.type = operation
......
......@@ -77,7 +77,7 @@ class HistoryDB(lazydb.LazyDB):
configs = []
for root, dirs, files in os.walk(package_path):
for f in files:
configs.append(("%s/%s" % (root, f)))
configs.append(("{0}/{1}".format(root, f)))
return configs
......
......@@ -415,8 +415,7 @@ class Builder:
if os.path.exists("/usr/lib/ccache/bin/gcc"):
self.has_ccache = True
os.environ["PATH"] = "/usr/lib/ccache/bin:%(PATH)s" \
% os.environ
os.environ["PATH"] = "/usr/lib/ccache/bin:%(PATH)s" % os.environ
# Force ccache to use /root/.ccache instead of $HOME/.ccache
# as $HOME can be modified through actions.py
os.environ["CCACHE_DIR"] = "/root/.ccache"
......
......@@ -38,7 +38,7 @@ def idsQuery(name, vendor, device):
else:
if line.startswith("\t"):
if line.startswith("\t" + device):
return "{0} - {1}" % (line[6:].strip(), company)
return "{0} - {1}".format(line[6:].strip(), company)
elif not line.startswith("#"):
flag = 0
if company != "":
......
......@@ -24,7 +24,7 @@ class grubCommand:
def __str__(self):
if self.options:
return "{0} {1} {2}" % (self.key, " ".join(self.options), self.value)
return "{0} {1} {2}".format(self.key, " ".join(self.options), self.value)
else:
return "{0} {1}".format(self.key, self.value)
......
......@@ -613,7 +613,7 @@ def strip_file(filepath, fileinfo, outpath):
if fileinfo == None:
ret, out, err = run_batch("file {}".format(filepath), ui_debug=False)
if ret:
ctx.ui.warning(_("file command failed with return code {0} for file: {1}") % (ret, filepath))
ctx.ui.warning(_("file command failed with return code {0} for file: {1}").format(ret, filepath))
ctx.ui.info(_("Output:\n{}").format(out), verbose=True)
elif "current ar archive" in fileinfo:
......@@ -706,12 +706,12 @@ def parse_package_name(package_name):
except:
raise Error(_("Invalid package name: {}").format(package_name))
return name, "{}-{}".format(version, release)
return name, "{0}-{1}".format(version, release)
def parse_package_dir_path(package_name):
name = parse_package_name(package_name)[0]
if name.split("-").pop() in ["devel", "32bit", "doc", "docs", "userspace"]: name = name[:-1 - len(name.split("-").pop())]
return "{}/{}".format(name[0:4].lower() if name.startswith("lib") and len(name) > 3 else name.lower()[0], name.lower())
return "{0}/{1}".format(name[0:4].lower() if name.startswith("lib") and len(name) > 3 else name.lower()[0], name.lower())
def parse_delta_package_name_legacy(package_name):
"""Separate delta package name and release infos for package formats <= 1.1.
......
......@@ -27,8 +27,8 @@ class FetchTestCase(unittest.TestCase):
os.remove(fetchedFile)
def testFetcherFunctions(self):
enc = base64.encodestring('%s:%s' % self.url.auth_info())
self.assertEqual(self.fetch._get_http_headers(),(('Authorization', 'Basic %s' % enc),))
enc = base64.encodestring('{0}:{0}'.format(self.url.auth_info()))
self.assertEqual(self.fetch._get_http_headers(),(('Authorization', 'Basic {}'.format(enc)),))
assert not self.fetch._get_ftp_headers()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment