build: use python f-strings
Change-Id: I955739ac40508642509521760c1bc75286c94f30
This commit is contained in:
1 parent
decaf509b4
commit
910232fce0
4 files changed
+26
-26
No files matched your search
+7
-7
@@ -1,6 +1,6 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
"""
|
||||
Copyright (c) 2014-2019, Regents of the University of California,
|
||||
Copyright (c) 2014-2023, Regents of the University of California,
|
||||
Arizona Board of Regents,
|
||||
Colorado State University,
|
||||
University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -29,20 +29,20 @@ def build(bld):
|
||||
for module, name in {"cs-benchmark": "CS Benchmark",
|
||||
"pit-fib-benchmark": "PIT & FIB Benchmark"}.items():
|
||||
# main
|
||||
bld.objects(target='other-tests-%s-main' % module,
|
||||
bld.objects(target=f'other-tests-{module}-main',
|
||||
source='../main.cpp',
|
||||
use='BOOST',
|
||||
defines=['BOOST_TEST_MODULE=%s' % name])
|
||||
defines=[f'BOOST_TEST_MODULE={name}'])
|
||||
# module
|
||||
bld.program(name=module,
|
||||
target='../../%s' % module,
|
||||
source=bld.path.ant_glob('%s*.cpp' % module),
|
||||
use='daemon-objects other-tests-%s-main' % module,
|
||||
target=f'{top}/{module}',
|
||||
source=bld.path.ant_glob(f'{module}*.cpp'),
|
||||
use=f'daemon-objects other-tests-{module}-main',
|
||||
install_path=None)
|
||||
|
||||
# face-benchmark does not rely on Boost.Test
|
||||
bld.program(name='face-benchmark',
|
||||
target='../../face-benchmark',
|
||||
target=f'{top}/face-benchmark',
|
||||
source=bld.path.ant_glob('face-benchmark*.cpp'),
|
||||
use='daemon-objects',
|
||||
install_path=None)
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
"""
|
||||
Copyright (c) 2014-2020, Regents of the University of California,
|
||||
Copyright (c) 2014-2023, Regents of the University of California,
|
||||
Arizona Board of Regents,
|
||||
Colorado State University,
|
||||
University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -41,10 +41,10 @@ def build(bld):
|
||||
|
||||
for module in ['core', 'daemon', 'rib', 'tools']:
|
||||
# main() for the module
|
||||
bld.objects(target='unit-tests-%s-main' % module,
|
||||
bld.objects(target=f'unit-tests-{module}-main',
|
||||
source='main.cpp',
|
||||
use='BOOST',
|
||||
defines=['BOOST_TEST_MODULE=NFD %s' % module.capitalize()])
|
||||
defines=[f'BOOST_TEST_MODULE=NFD {module.capitalize()}'])
|
||||
|
||||
subdir = 'daemon/rib' if module == 'rib' else module
|
||||
node = bld.path.find_dir(subdir)
|
||||
@@ -66,10 +66,10 @@ def build(bld):
|
||||
|
||||
objmod = 'daemon' if module == 'rib' else module
|
||||
# unit-tests binary for the module
|
||||
bld.program(name='unit-tests-%s' % module,
|
||||
target='../unit-tests-%s' % module,
|
||||
bld.program(name=f'unit-tests-{module}',
|
||||
target=f'{top}/unit-tests-{module}',
|
||||
source=src,
|
||||
use='%s-objects tests-common unit-tests-%s-main' % (objmod, module),
|
||||
use=f'{objmod}-objects tests-common unit-tests-{module}-main',
|
||||
defines=[tmpdir],
|
||||
install_path=None)
|
||||
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
"""
|
||||
Copyright (c) 2014-2022, Regents of the University of California,
|
||||
Copyright (c) 2014-2023, Regents of the University of California,
|
||||
Arizona Board of Regents,
|
||||
Colorado State University,
|
||||
University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -25,7 +25,7 @@ NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from waflib import Context, Utils
|
||||
|
||||
top = '../'
|
||||
top = '..'
|
||||
|
||||
def build(bld):
|
||||
# Single object tools:
|
||||
@@ -34,7 +34,7 @@ def build(bld):
|
||||
for tool in bld.path.ant_glob('*.cpp'):
|
||||
name = tool.change_ext('').path_from(bld.path.get_bld())
|
||||
bld.program(name=name,
|
||||
target=top + 'bin/%s' % name,
|
||||
target=f'{top}/bin/{name}',
|
||||
source=[tool],
|
||||
use='core-objects')
|
||||
|
||||
@@ -59,7 +59,7 @@ def build(bld):
|
||||
srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp'])
|
||||
srcObjects = ''
|
||||
if srcFiles:
|
||||
srcObjects = 'tools-%s-objects' % name
|
||||
srcObjects = f'tools-{name}-objects'
|
||||
bld.objects(target=srcObjects,
|
||||
source=srcFiles,
|
||||
features='pch',
|
||||
@@ -69,7 +69,7 @@ def build(bld):
|
||||
testableObjects.append(srcObjects)
|
||||
|
||||
bld.program(name=name,
|
||||
target=top + 'bin/%s' % name,
|
||||
target=f'{top}/bin/{name}',
|
||||
source=[mainFile],
|
||||
use='core-objects ' + srcObjects,
|
||||
includes=name)
|
||||
@@ -84,7 +84,7 @@ def build(bld):
|
||||
name = script.change_ext('').path_from(bld.path.get_bld())
|
||||
bld(features='subst',
|
||||
name=name,
|
||||
target=top + 'bin/%s' % name,
|
||||
target=f'{top}/bin/{name}',
|
||||
source=[script],
|
||||
install_path='${BINDIR}',
|
||||
chmod=Utils.O755,
|
||||
|
||||
@@ -140,7 +140,7 @@ def configure(conf):
|
||||
|
||||
conf.define_cond('WITH_TESTS', conf.env.WITH_TESTS)
|
||||
conf.define_cond('WITH_OTHER_TESTS', conf.env.WITH_OTHER_TESTS)
|
||||
conf.define('DEFAULT_CONFIG_FILE', '%s/ndn/nfd.conf' % conf.env.SYSCONFDIR)
|
||||
conf.define('DEFAULT_CONFIG_FILE', f'{conf.env.SYSCONFDIR}/ndn/nfd.conf')
|
||||
# The config header will contain all defines that were added using conf.define()
|
||||
# or conf.define_cond(). Everything that was added directly to conf.env.DEFINES
|
||||
# will not appear in the config header, but will instead be passed directly to the
|
||||
@@ -304,16 +304,16 @@ def version(ctx):
|
||||
# first, try to get a version string from git
|
||||
gotVersionFromGit = False
|
||||
try:
|
||||
cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
|
||||
out = subprocess.check_output(cmd, universal_newlines=True).strip()
|
||||
cmd = ['git', 'describe', '--always', '--match', f'{GIT_TAG_PREFIX}*']
|
||||
out = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
|
||||
if out:
|
||||
gotVersionFromGit = True
|
||||
if out.startswith(GIT_TAG_PREFIX):
|
||||
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
|
||||
else:
|
||||
# no tags matched
|
||||
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
Context.g_module.VERSION = f'{VERSION_BASE}-commit-{out}'
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
|
||||
versionFile = ctx.path.find_node('VERSION.info')
|
||||
@@ -331,14 +331,14 @@ def version(ctx):
|
||||
# already up-to-date
|
||||
return
|
||||
except EnvironmentError as e:
|
||||
Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
|
||||
Logs.warn(f'{versionFile} exists but is not readable ({e.strerror})')
|
||||
else:
|
||||
versionFile = ctx.path.make_node('VERSION.info')
|
||||
|
||||
try:
|
||||
versionFile.write(Context.g_module.VERSION)
|
||||
except EnvironmentError as e:
|
||||
Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
|
||||
Logs.warn(f'{versionFile} is not writable ({e.strerror})')
|
||||
|
||||
def dist(ctx):
|
||||
ctx.algo = 'tar.xz'
|
||||
|
||||
Reference in new issue
Block a user