diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/depend-java-query | 16 | ||||
-rwxr-xr-x | src/gjl | 13 | ||||
-rwxr-xr-x | src/java-config-2 | 14 | ||||
-rw-r--r-- | src/java_config_2/__init__.py | 7 | ||||
-rw-r--r-- | src/java_config_2/meson.build | 20 | ||||
-rwxr-xr-x[-rw-r--r--] | src/launcher.bash | 15 | ||||
-rw-r--r-- | src/meson.build | 36 |
7 files changed, 98 insertions, 23 deletions
diff --git a/src/depend-java-query b/src/depend-java-query index 04414f2..394b7e3 100755 --- a/src/depend-java-query +++ b/src/depend-java-query @@ -1,5 +1,5 @@ -#!/@GENTOO_PORTAGE_EPREFIX@usr/bin/python -E -# -*- coding: UTF-8 -*- +#!/usr/bin/python +# -*- coding: utf-8 -*- # Copyright 2004-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -15,7 +15,8 @@ import sys from optparse import OptionParser, make_option, OptionValueError def version(option, opt, value, parser): - printer._print("%H%BJava Dep Query Utility %GVersion @PACKAGE_VERSION@") + import java_config_2 + printer._print(f"%H%BJava Dep Query Utility %GVersion {java_config_2.version}") raise SystemExit() def nocolor(option, opt, value, parser): @@ -62,15 +63,16 @@ def parse_depend_string(option, opt, value, parse): if __name__ == '__main__': global printer, manager, verman + import java_config_2 printer = OutputFormatter(True, True) - manager = EnvironmentManager(os.getenv('ROOT', ''), os.getenv('EPREFIX', '@GENTOO_PORTAGE_EPREFIX@')) + manager = EnvironmentManager(os.getenv('ROOT', ''), java_config_2.eprefix) verman = VersionManager(manager) usage = "depend-java-query [options]\n\n" - usage += "Java Dep Query Utility Version @PACKAGE_VERSION@\n" - usage += "Copyright 2004-2013 Gentoo Foundation\n" + usage += f"Java Dep Query Utility Version {java_config_2.version}\n" + usage += "Copyright 2004-2023 Gentoo Authors\n" usage += "Distributed under the terms of the GNU General Public License v2\n" - usage += "Please contact the Gentoo Java Herd <java@gentoo.org> with problems." + usage += "Please contact the Gentoo Java Project <java@gentoo.org> with problems." options_list = [ make_option ("-V", "--version", action="callback", callback=version, help="Print version information"), @@ -1,5 +1,5 @@ -#!/@GENTOO_PORTAGE_EPREFIX@usr/bin/python -E -# -*- coding: UTF-8 -*- +#!/usr/bin/python +# -*- coding: utf-8 -*- # Copyright 2004-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 @@ -91,11 +91,12 @@ def normpath(mypath): return newpath if __name__ == '__main__': + import java_config_2 usage = "%prog [options]\n\n" - usage += "Java Utility Version @PACKAGE_VERSION@\n" - usage += "Copyright 2004-2013 Gentoo Foundation\n" + usage += f"Java Utility Version {java_config_2.version}\n" + usage += "Copyright 2004-2023 Gentoo Authors\n" usage += "Distributed under the terms of the GNU General Public License v2\n" - usage += "Please contact the Gentoo Java Herd <java@gentoo.org> with problems." + usage += "Please contact the Gentoo Java Project <java@gentoo.org> with problems." options_list = [ make_option ("-p", "--package", action="store", type="string", dest="package", help="The package"), @@ -109,7 +110,7 @@ if __name__ == '__main__': global printer, manager, verman printer = OutputFormatter(True, True) - manager = EnvironmentManager(os.getenv('ROOT', ''), os.getenv('EPREFIX', '@GENTOO_PORTAGE_EPREFIX@')) + manager = EnvironmentManager(os.getenv('ROOT', ''), java_config_2.eprefix) verman = VersionManager(manager) if not options.package: diff --git a/src/java-config-2 b/src/java-config-2 index d542d66..3f140b8 100755 --- a/src/java-config-2 +++ b/src/java-config-2 @@ -1,5 +1,5 @@ -#!/@GENTOO_PORTAGE_EPREFIX@usr/bin/python -E -# -*- coding: UTF-8 -*- +#!/usr/bin/python +# -*- coding: utf-8 -*- # Copyright 2004-2018 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 @@ -20,7 +20,8 @@ except ImportError: from optparse import OptionParser, OptionGroup def version(option, opt, value, parser): - printer._print("%H%BJava Configuration Utility %GVersion @PACKAGE_VERSION@") + import java_config_2 + printer._print(f"%H%BJava Configuration Utility %GVersion {java_config_2.version}") raise SystemExit() def nocolor(option, opt, value, parser): @@ -183,11 +184,12 @@ def fatalError(msg): if __name__ == '__main__': global printer, manager + import java_config_2 printer = OutputFormatter(True, True) - manager = EnvironmentManager(os.getenv('ROOT', ''), os.getenv('EPREFIX', '@GENTOO_PORTAGE_EPREFIX@')) + manager = EnvironmentManager(os.getenv('ROOT', ''), java_config_2.eprefix) - usage = """java-config [options] -Java Configuration Utility Version @PACKAGE_VERSION@ + usage = f"""java-config [options] +Java Configuration Utility Version {java_config_2.version} Copyright 2004-2013 Gentoo Foundation Distributed under the terms of the GNU General Public License v2 Please contact the Gentoo Java Herd <java@gentoo.org> with problems.""" diff --git a/src/java_config_2/__init__.py b/src/java_config_2/__init__.py index b30192a..eacd90e 100644 --- a/src/java_config_2/__init__.py +++ b/src/java_config_2/__init__.py @@ -1 +1,6 @@ -__version__ = '@PACKAGE_VERSION@' +import os + +version = '@VERSION@' if not '@VERSION@'.startswith('@') else 'unknown' + +eprefix_fallback = '@EPREFIX@' if not '@EPREFIX@'.startswith('@') else '' +eprefix = os.getenv('EPREFIX', eprefix_fallback) diff --git a/src/java_config_2/meson.build b/src/java_config_2/meson.build new file mode 100644 index 0000000..417430d --- /dev/null +++ b/src/java_config_2/meson.build @@ -0,0 +1,20 @@ +__init__py = configure_file( + input : '__init__.py', + output : '__init__.py', + configuration : conf_data +) + +py.install_sources( + [ + 'EnvironmentManager.py', + 'Errors.py', + 'FileParser.py', + 'OutputFormatter.py', + 'Package.py', + 'VM.py', + 'VersionManager.py', + 'Virtual.py', + __init__py, + ], + subdir: 'java_config_2', +) diff --git a/src/launcher.bash b/src/launcher.bash index 12f7103..36a1782 100644..100755 --- a/src/launcher.bash +++ b/src/launcher.bash @@ -1,4 +1,4 @@ -#!/@GENTOO_PORTAGE_EPREFIX@bin/bash +#!/usr/bin/env bash abort() { echo ${@} >&2 @@ -18,10 +18,19 @@ unset GENTOO_PYTHON_WRAPPER_SCRIPT_PATH unset GENTOO_PYTHON_TARGET_SCRIPT_PATH unset GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION +if [[ ! -v EPREFIX ]]; then + INJECTED_PREFIX="@EPREFIX@" + if [[ ${INJECTED_PREFIX} == @* ]]; then + EPREFIX="" + else + EPREFIX="${INJECTED_PREFIX}" + fi +fi + # Source package env # --------------------- -gjl_user_env="${HOME}/.gentoo@GENTOO_PORTAGE_EPREFIX@/java-config-2/launcher.d/${gjl_package}" -gjl_system_env="@GENTOO_PORTAGE_EPREFIX@/etc/java-config-2/launcher.d/${gjl_package}" +gjl_user_env="${HOME}/.gentoo${EPREFIX}/java-config-2/launcher.d/${gjl_package}" +gjl_system_env="${EPREFIX}/etc/java-config-2/launcher.d/${gjl_package}" if [[ -f "${gjl_user_env}" ]]; then source "${gjl_user_env}" elif [[ -f "${gjl_system_env}" ]]; then diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..c3a4dd9 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,36 @@ +subdir('java_config_2') + +py_bins = [ + 'depend-java-query', + 'gjl', + 'java-config-2', +] + +# It might seem sensible to use py.install_sources() to install the Python +# scripts, but it's really just a wrapper around install_data that forces the +# install_dir. Meson 1.2.0 and later also optimize to bytecode, but Gentoo does +# this in the ebuild. +install_data( + py_bins, + install_dir: get_option('bindir'), + install_mode: 'rwxr-xr-x', +) + +if python_only + subdir_done() +endif + +launcherdir_rel = 'share' / 'java-config-2' / 'launcher' +launcherdir = system_wide ? eprefix / launcherdir_rel \ + : datadir / eprefix / launcherdir_rel + +launcher_bash = configure_file( + input: 'launcher.bash', + output: 'launcher.bash', + configuration: conf_data, +) + +install_data( + [launcher_bash], + install_dir: launcherdir, +) |