13
0

wscript: sanitize strings from fetch_*_revision_date early instead of applying str() all over

This can perhaps be simplified further when Python2 support is dropped.
This commit is contained in:
Mads Kiilerich 2022-10-16 00:59:21 +02:00 committed by Paul Davis
parent 615326be9b
commit 2973e82a90
7 changed files with 29 additions and 30 deletions

View File

@ -695,7 +695,7 @@ def build(bld):
obj = bld(features = 'subst')
obj.source = 'ardour.sh.in'
obj.target = 'ardour' + str (bld.env['MAJOR'])
obj.target = 'ardour' + bld.env['MAJOR']
obj.chmod = Utils.O755
obj.dict = wrapper_subst_dict
obj.install_path = bld.env['BINDIR']
@ -827,16 +827,16 @@ def build(bld):
# Freedesktop
freedesktop_subst_dict = {
'ARDOUR_EXEC' : str (bld.env['lwrcase_dirname']),
'ARDOUR_ICON' : str (bld.env['lwrcase_dirname']),
'ARDOUR_EXEC' : bld.env['lwrcase_dirname'],
'ARDOUR_ICON' : bld.env['lwrcase_dirname'],
'VERSION': bld.env['VERSION'],
'DATE': str (bld.env['DATE']),
'DATE': bld.env['DATE'],
}
if bld.env['FREEDESKTOP']:
obj = bld(features = 'subst')
obj.source = 'ardour.desktop.in'
obj.target = str (bld.env['lwrcase_dirname']) + '.desktop'
obj.target = bld.env['lwrcase_dirname'] + '.desktop'
obj.chmod = Utils.O644
obj.dict = freedesktop_subst_dict
set_subst_dict(obj, freedesktop_subst_dict)
@ -853,14 +853,14 @@ def build(bld):
appdata_i18n_xmlin(bld)
obj = bld(features = 'subst')
obj.source = 'ardour.appdata.xml.in'
obj.target = str (bld.env['lwrcase_dirname']) + '.appdata.xml'
obj.target = bld.env['lwrcase_dirname'] + '.appdata.xml'
obj.chmod = Utils.O644
obj.dict = freedesktop_subst_dict
set_subst_dict(obj, freedesktop_subst_dict)
bld.install_files (os.path.join (bld.env['PREFIX'], 'share/appdata'), obj.target)
# install desktop icon files
icon_file_name = str (bld.env['lwrcase_dirname']) + '.png'
icon_file_name = bld.env['lwrcase_dirname'] + '.png'
bld.install_as('${PREFIX}/share/icons/hicolor/16x16/apps/' + icon_file_name, 'resources/Ardour-icon_16px.png')
bld.install_as('${PREFIX}/share/icons/hicolor/22x22/apps/'+ icon_file_name, 'resources/Ardour-icon_22px.png')
bld.install_as('${PREFIX}/share/icons/hicolor/32x32/apps/'+ icon_file_name, 'resources/Ardour-icon_32px.png')

View File

@ -406,7 +406,7 @@ def build(bld):
obj.vnum = LIBARDOUR_LIB_VERSION
obj.install_path = bld.env['LIBDIR']
obj.defines += [
'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
'PACKAGE="' + I18N_PACKAGE + bld.env['MAJOR'] + '"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
@ -574,7 +574,7 @@ def build(bld):
mo_files = bld.path.ant_glob('po/*.mo')
for mo in mo_files:
lang = os.path.basename(mo.srcpath()).replace('.mo', '')
bld.install_as(os.path.join(bld.env['LOCALEDIR'], lang, 'LC_MESSAGES', I18N_PACKAGE + str(bld.env['MAJOR']) + '.mo'),
bld.install_as(os.path.join(bld.env['LOCALEDIR'], lang, 'LC_MESSAGES', I18N_PACKAGE + bld.env['MAJOR'] + '.mo'),
mo)
if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
@ -592,7 +592,7 @@ def build(bld):
else:
testcommon.use.extend(['libltc', 'librubberband', 'libfluidsynth'])
testcommon.defines = [
'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
'PACKAGE="libardour' + bld.env['MAJOR'] + 'test"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
@ -668,7 +668,7 @@ def build(bld):
load_save_session.target = 'load-save-session'
load_save_session.install_path = ''
load_save_session.defines = [
'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
'PACKAGE="libardour' + bld.env['MAJOR'] + 'profile"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
@ -694,7 +694,7 @@ def build(bld):
profilingobj.target = p
profilingobj.install_path = ''
profilingobj.defines = [
'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'profile"',
'PACKAGE="libardour' + bld.env['MAJOR'] + 'profile"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
@ -712,24 +712,24 @@ def create_ardour_test_program(bld, includes, name, target, sources):
# not sure about install path
testobj.install_path = bld.env['LIBDIR']
testobj.defines = [
'PACKAGE="libardour' + str(bld.env['MAJOR']) + 'test"',
'PACKAGE="libardour' + bld.env['MAJOR'] + 'test"',
'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"',
'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"',
'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
]
def i18n(bld):
autowaf.build_i18n(bld, '.', 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
autowaf.build_i18n(bld, '.', 'libs/ardour', I18N_PACKAGE + bld.env['MAJOR'], libardour_sources,
'Paul Davis')
def i18n_pot(bld):
autowaf.build_i18n(bld, '.', 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
autowaf.build_i18n(bld, '.', 'libs/ardour', I18N_PACKAGE + bld.env['MAJOR'], libardour_sources,
'Paul Davis')
def i18n_po(bld):
autowaf.build_i18n_po(bld, '.', 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
autowaf.build_i18n_po(bld, '.', 'libs/ardour', I18N_PACKAGE + bld.env['MAJOR'], libardour_sources,
'Paul Davis')
def i18n_mo(bld):
autowaf.build_i18n_mo(bld, '.', 'libs/ardour', I18N_PACKAGE + str(bld.env['MAJOR']), libardour_sources,
autowaf.build_i18n_mo(bld, '.', 'libs/ardour', I18N_PACKAGE + bld.env['MAJOR'], libardour_sources,
'Paul Davis')

View File

@ -19,7 +19,7 @@ def build(bld):
obj.defines = [
'AU_SCANNER_APP',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',
'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
'PACKAGE="' + I18N_PACKAGE + bld.env['MAJOR'] + '"',
'LIBARDOUR="' + bld.env['lwrcase_dirname'] + '"',
'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
]

View File

@ -22,7 +22,7 @@ def build(bld):
obj.defines = [
'VST3_SCANNER_APP',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',
'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
'PACKAGE="' + I18N_PACKAGE + bld.env['MAJOR'] + '"',
'LIBARDOUR="' + bld.env['lwrcase_dirname'] + '"',
'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"',
]
@ -64,7 +64,7 @@ def build(bld):
'_POSIX_SOURCE',
'USE_WS_PREFIX',
'VST_SCANNER_APP',
'PACKAGE="' + I18N_PACKAGE + str(bld.env['MAJOR']) + '"',
'PACKAGE="' + I18N_PACKAGE + bld.env['MAJOR'] + '"',
'LIBARDOUR="' + bld.env['lwrcase_dirname'] + '"',
'VERSIONSTRING="' + bld.env['VERSION'] + '"',
]

View File

@ -22,7 +22,7 @@ def build(bld):
if bld.env['build_target'] != 'mingw':
obj = bld(features = 'subst')
obj.source = 'ardour-lua.sh.in'
obj.target = 'ardour' + str (bld.env['MAJOR']) + '-lua'
obj.target = 'ardour' + bld.env['MAJOR'] + '-lua'
obj.chmod = Utils.O755
obj.install_path = bld.env['BINDIR']
obj.LIBDIR = os.path.normpath(bld.env['DLLDIR'])
@ -72,6 +72,6 @@ def build(bld):
if bld.env['build_target'] == 'mingw':
obj.install_path = bld.env['BINDIR']
obj.target = 'ardour' + str (bld.env['MAJOR']) + '-lua'
obj.target = 'ardour' + bld.env['MAJOR'] + '-lua'
else:
obj.install_path = bld.env['DLLDIR']

View File

@ -16,7 +16,7 @@ def configure(conf):
autowaf.display_msg(conf, 'build session-utils', 'yes')
def build_ardour_util(bld, util):
pgmprefix = bld.env['PROGRAM_NAME'].lower() + str(bld.env['MAJOR'])
pgmprefix = bld.env['PROGRAM_NAME'].lower() + bld.env['MAJOR']
# just the normal executable version of the GTK GUI
obj = bld (features = 'cxx c cxxprogram')
@ -66,7 +66,7 @@ def build(bld):
if not "dummy" in bld.env['BACKENDS']:
return
pgmprefix = bld.env['PROGRAM_NAME'].lower() + str(bld.env['MAJOR'])
pgmprefix = bld.env['PROGRAM_NAME'].lower() + bld.env['MAJOR']
utils = bld.path.ant_glob('[a-z]*.cc', excl=['example.cc', 'common.cc'])

11
wscript
View File

@ -222,13 +222,14 @@ def set_version (from_file = False):
rev, rev_date = fetch_git_revision_date()
else:
rev, rev_date = fetch_tarball_revision_date()
rev_date = sanitize(rev_date)
#
# rev is now of the form MAJOR.MINOR[-rcX]-rev-commit
# or, if right at the same rev as a release, MAJOR.MINOR[-rcX]
#
parts = rev.split ('.', 1)
parts = sanitize(rev).split ('.', 1)
MAJOR = parts[0]
other = parts[1].split('-', 1)
MINOR = other[0]
@ -237,10 +238,8 @@ def set_version (from_file = False):
else:
MICRO = '0'
V = MAJOR + '.' + MINOR + '.' + MICRO
VERSION = sanitize(V)
PROGRAM_VERSION = sanitize(MAJOR)
VERSION = MAJOR + '.' + MINOR + '.' + MICRO
PROGRAM_VERSION = MAJOR
def fetch_gcc_version (CC):
cmd = "%s --version" % CC
@ -1057,7 +1056,7 @@ def configure(conf):
if Options.options.lv2dir:
conf.env['LV2DIR'] = Options.options.lv2dir
else:
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'ardour' + str(conf.env['MAJOR']), 'LV2')
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'ardour' + conf.env['MAJOR'], 'LV2')
conf.env['LV2DIR'] = os.path.normpath(conf.env['LV2DIR'])