test/integration/jw-pkg: Rename to jw_pkg for mypy module names #141

Merged
Jan Lindemann merged 2 commits from jan/fix/20261016-test-integration-jw-pkg-rename-to-jw-pkg-for-mypy-module-names into master 2026-10-16 09:35:47 +02:00 AGit
28 changed files with 0 additions and 0 deletions
Showing only changes of commit 61c9479e79 - Show all commits

test/integration/jw-pkg -> test/integration/jw_pkg

The mypy module names of the test tree derive from the full path, anchored
by the top-level test/__init__.py, but a file below a path component that
is not a valid identifier - the dashes in jw-pkg - falls back to the bare
file name, so two same-named test.py drivers collide (the duplicate module
error that drove the runme.py and main.py renames).

Rename the directory a sane Python name - jw_pkg, that's the better fix.
Then name the driver test.py like all the others for consistency.

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-10-15 11:08:09 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -0,0 +1,4 @@
TOPDIR = ../../..
include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/dirs.mk

View file

@ -0,0 +1,19 @@
TOPDIR = ../../../..
OUTPUT = test-out.txt
REFERENCE = test-expected.txt
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
$(OUTPUT): Makefile test.sh
bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp
diff $(REFERENCE) $(OUTPUT).tmp
mv $(OUTPUT).tmp $(OUTPUT)
test: $(OUTPUT)
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f $(OUTPUT) $(OUTPUT).tmp

View file

@ -0,0 +1,906 @@
============= Running: jw-pkg.py -t ../../../.. --log-level info --help
usage: jw-pkg.py [--log-flags LOG_FLAGS] [--log-level LOG_LEVEL]
[--log-file LOG_FILE] [--backtrace]
[--write-profile WRITE_PROFILE]
[--interactive {true,false,auto}] [--verbose]
[--target TARGET] [-t TOPDIR] [--topdir-format TOPDIR_FORMAT]
[-p PREFIX] [--distro-id DISTRO_ID] [--pkg-filter PKG_FILTER]
[-h]
...
jw-pkg swiss army knife
options:
--log-flags LOG_FLAGS
Log flags (default: color,position,prio,stderr)
--log-level LOG_LEVEL
Log level (default: 5)
--log-file LOG_FILE Log file (default: None)
--backtrace Show exception backtraces (default: False)
--write-profile WRITE_PROFILE
Profile code and store output to file (default: None)
--interactive {true,false,auto}
Wait for user input or try to proceed unattended
(default: true)
--verbose Be verbose on stderr about what's being done on the
distro level (default: False)
--target TARGET Run commands on this host (default: local)
-t, --topdir TOPDIR Project Path (default: None)
--topdir-format TOPDIR_FORMAT
Output references to topdir as one of "make:<var-
name>", "unaltered", "relative", "absolute". Absolute
topdir by default (default: absolute)
-p, --prefix PREFIX Parent directory of project source directories
(default: None)
--distro-id DISTRO_ID
Distribution ID (default is taken from /etc/os-
release) (default: None)
--pkg-filter PKG_FILTER
Default filter for all distribution package-related
operations (default: None)
-h, --help Show this help message and exit
Available subcommands:
packages (pkg) System package manager wrapper
platform Miscellaneous platform-related commands
posix Perform various operations on a distro through its
POSIX utility interface
projects Project metadata evaluation for building packages
secrets Manage package secrets
============= Running: jw-pkg.py -t ../../../.. --log-level info packages --help
usage: jw-pkg.py packages [-h] ...
System package manager wrapper
options:
-h, --help show this help message and exit
Available subcommands of packages:
delete Delete packages by name
dup Upgrade distribution
install Install the distribution's notion of available packages
ls List package contents
meta List package metadata
reboot-required Check whether the machine needs rebooting
refresh Refresh the distribution's notion of available packages
select Select packages by filter
============= Running: jw-pkg.py -t ../../../.. --log-level info packages delete --help
usage: jw-pkg.py packages delete [-h] [names ...]
Delete packages by name
positional arguments:
names Names of packages to be deleted (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info packages dup --help
usage: jw-pkg.py packages dup [-h] [--download-only]
Upgrade distribution
options:
-h, --help show this help message and exit
--download-only Only download packages from the repos, don't install them,
yet (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info packages install --help
usage: jw-pkg.py packages install [-h] [--only-update] [-F] [names ...]
Install the distribution's notion of available packages
positional arguments:
names Packages to be installed (default: None)
options:
-h, --help show this help message and exit
--only-update Only update the listed packages, don't install them
(default: False)
-F, --fixed-strings Don't expand macros in <names> (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info packages ls --help
usage: jw-pkg.py packages ls [-h] [names ...]
List package contents
positional arguments:
names Package names (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info packages meta --help
usage: jw-pkg.py packages meta [-h] [names ...]
List package metadata
positional arguments:
names Package names (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info packages reboot-required --help
usage: jw-pkg.py packages reboot-required [-h]
Check whether the machine needs rebooting
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info packages refresh --help
usage: jw-pkg.py packages refresh [-h]
Refresh the distribution's notion of available packages
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info packages select --help
usage: jw-pkg.py packages select [-h] filter
Select packages by filter
positional arguments:
filter Package filter string
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info platform --help
usage: jw-pkg.py platform [-h] ...
Miscellaneous platform-related commands
options:
-h, --help show this help message and exit
Available subcommands of platform:
info Retrieve information about target platform
============= Running: jw-pkg.py -t ../../../.. --log-level info platform info --help
usage: jw-pkg.py platform info [-h] [--format FORMAT]
Retrieve information about target platform
options:
-h, --help show this help message and exit
--format FORMAT Format string, expanding macros %{os}, %{id}, %{name},
%{codename}, %{gnu-triplet}, %{cascade}, %{os-release},
%{pkg-ext} (default: %{cascade})
============= Running: jw-pkg.py -t ../../../.. --log-level info posix --help
usage: jw-pkg.py posix [-h] ...
Perform various operations on a distro through its POSIX utility interface
options:
-h, --help show this help message and exit
Available subcommands of posix:
copy Copy files
tar Handle tar archives
============= Running: jw-pkg.py -t ../../../.. --log-level info posix copy --help
usage: jw-pkg.py posix copy [-h] [-o OWNER] [-g GROUP] [-m MODE] [-r] [-F]
src dst
Copy files
positional arguments:
src Source file URI
dst Destination file URI
options:
-h, --help show this help message and exit
-o, --owner OWNER Destination file owner (default: None)
-g, --group GROUP Destination file group (default: None)
-m, --mode MODE Destination file mode (default: None)
-r, --recursive Copy directories recursively (default: False)
-F, --fixed-strings Don't expand macros in <src> and <dst> (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info posix tar --help
usage: jw-pkg.py posix tar [-h] ...
Handle tar archives
options:
-h, --help show this help message and exit
Available subcommands of tar:
x Extract a tar archive
============= Running: jw-pkg.py -t ../../../.. --log-level info posix tar x --help
usage: jw-pkg.py posix tar x [-h] -f ARCHIVE_PATH dst
Extract a tar archive
positional arguments:
dst Destination root URI
options:
-h, --help show this help message and exit
-f, --archive-path ARCHIVE_PATH
Archive path
============= Running: jw-pkg.py -t ../../../.. --log-level info projects --help
usage: jw-pkg.py projects [-h] ...
Project metadata evaluation for building packages
options:
-h, --help show this help message and exit
Available subcommands of projects:
build janware software project build tool
canonicalize-remotes
Streamline janware Git remotes
cflags cflags
check Run miscellaneous code and project checks
commands List available commands
create-file Generate a file from project metadata
create-pkg-config Generate a pkg-config file for a module
exepath exepath
get-auth-info Try to retrieve authentication information from the
source tree
getval Get value from project config
htdocs-dir Print source directory containing document root of a
given module
ldflags ldflags
ldlibpath ldlibpath
libname libname
list-repos Query a remote GIT server for repositories
modules Query existing janware packages
path path
pkg-conflicts Print packages conflicting with a given package
pkg-provides Print packages and capabilities provided by a given
package
pkg-recommends Print recommended packages
pkg-requires Print packages required for a given package
proj-dir Print directory of a given package
pythonpath Generate PYTHONPATH for given modules
required-os-pkg List distribution packages required for a package
summary Print summary description of given modules
test Test
tmpl-dir Print directory containing templates of a given module
============= Running: jw-pkg.py -t ../../../.. --log-level info projects build --help
usage: jw-pkg.py projects build [-h] [--exclude EXCLUDE] [-n] [-O] [-I]
[--dep-flavours DEP_FLAVOURS]
[--pkg-relations PKG_RELATIONS] [--env-reinit]
[--env-keep ENV_KEEP]
target modules [modules ...]
janware software project build tool
positional arguments:
target Build target
modules Modules to be built
options:
-h, --help show this help message and exit
--exclude EXCLUDE Space seperated ist of modules to be excluded from
build (default: )
-n, --dry-run Don't build anything, just print what would be done.
(default: False)
-O, --build-order Don't build anything, just print the build order.
(default: False)
-I, --ignore-deps Don't build dependencies, i.e. build only modules
specified on the command line (default: False)
--dep-flavours DEP_FLAVOURS
Dependency flavours to take into consideration for
build, comma or space separated (default: auto)
--pkg-relations PKG_RELATIONS
Relations between packages to take into consideration
for build, comma or space separated (default:
requires)
--env-reinit Source /etc/profile before each build step. Discard
environment unless --env-keep is specified (default:
False)
--env-keep ENV_KEEP Comma seperated list of environment variables to keep,
"all" or "none", only meaningful if --env-reinit is
specified (default: none)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects canonicalize-remotes --help
usage: jw-pkg.py projects canonicalize-remotes [-h] [-n]
Streamline janware Git remotes
options:
-h, --help show this help message and exit
-n, --dry-run Only log what would be done (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects cflags --help
usage: jw-pkg.py projects cflags [-h] [module ...]
cflags
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects check --help
usage: jw-pkg.py projects check [-h] ...
Run miscellaneous code and project checks
options:
-h, --help show this help message and exit
Available subcommands of check:
deps Check for circular dependencies between given modules
============= Running: jw-pkg.py -t ../../../.. --log-level info projects check deps --help
usage: jw-pkg.py projects check deps [-h] [-f [FLAVOUR]] [module ...]
Check for circular dependencies between given modules
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
-f, --flavour [FLAVOUR]
============= Running: jw-pkg.py -t ../../../.. --log-level info projects commands --help
usage: jw-pkg.py projects commands [-h]
List available commands
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects create-file --help
usage: jw-pkg.py projects create-file [-h] --format {pyright,tmpl}
[--search-path SEARCH_PATH]
[--template-name TEMPLATE_NAME]
[--quote] [-f KEY=VALUE]
[--field-keys FIELD_KEYS]
[--field-separator FIELD_SEPARATOR]
module
Generate a file from project metadata
positional arguments:
module The module to generate the file for
options:
-h, --help show this help message and exit
--format {pyright,tmpl}
Output format, one of: pyright, tmpl
--search-path SEARCH_PATH
Template search path, colon separated (default:
/etc/opt/jw-pkg/templates)
--template-name TEMPLATE_NAME
Template file name (default: None)
--quote Enclose variable values in double quotes before
substituting (default: False)
-f, --field KEY=VALUE
Additional fields to insert into the output file
(default: [])
--field-keys FIELD_KEYS
Possible keys for the --field option, comma-separated.
Defaults to all passed via the --field option. If this
field is specified, passing a key in --field that's
not specified here is an error, and not passing one
makes the respective field go away from the rendering
output (default: None)
--field-separator FIELD_SEPARATOR
Field separator. %n expands to newline. Default value
depends on --format (default: None)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects create-pkg-config --help
usage: jw-pkg.py projects create-pkg-config [-h] [-F PROJECT_DESCR_FILE]
[-d DESCRIPTION] [-n NAME]
[-s SUMMARY] [-p PREFIX]
[-v VERSION] [-c CFLAGS]
[-l LIBFLAGS] [-r REQUIRES_RUN]
[-R REQUIRES_BUILD]
[-V [VARIABLES ...]]
Generate a pkg-config file for a module
options:
-h, --help show this help message and exit
-F, --project-descr-file PROJECT_DESCR_FILE
-d, --description DESCRIPTION
-n, --name NAME
-s, --summary SUMMARY
-p, --prefix PREFIX
-v, --version VERSION
-c, --cflags CFLAGS
-l, --libflags LIBFLAGS
-r, --requires-run REQUIRES_RUN
-R, --requires-build REQUIRES_BUILD
-V, --variables [VARIABLES ...]
============= Running: jw-pkg.py -t ../../../.. --log-level info projects exepath --help
usage: jw-pkg.py projects exepath [-h] [-d [DELIMITER]] [module ...]
exepath
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
-d, --delimiter [DELIMITER]
Output words delimiter (default: :)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects get-auth-info --help
usage: jw-pkg.py projects get-auth-info [-h] [--only-values] [--username]
[--password] [--remote-owner-base]
[--remote-base]
Try to retrieve authentication information from the source tree
options:
-h, --help show this help message and exit
--only-values Don't prefix values by "<field-name>=" (default: False)
--username Show user name (default: False)
--password Show password (default: False)
--remote-owner-base Show remote base URL for owner jw-pkg was cloned from
(default: False)
--remote-base Show remote base URL (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects getval --help
usage: jw-pkg.py projects getval [-h] [--project PROJECT] section key
Get value from project config
positional arguments:
section Config section
key Config key
options:
-h, --help show this help message and exit
--project PROJECT Project name, default is name of project's topdir
(default: None)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects htdocs-dir --help
usage: jw-pkg.py projects htdocs-dir [-h] [module ...]
Print source directory containing document root of a given module
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects ldflags --help
usage: jw-pkg.py projects ldflags [-h] [--exclude EXCLUDE] [-s] [module ...]
ldflags
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
--exclude EXCLUDE Exclude Modules (default: [])
-s, --add-self Include libflags of specified modules, too, not only
their dependencies (default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects ldlibpath --help
usage: jw-pkg.py projects ldlibpath [-h] [-d [DELIMITER]] [module ...]
ldlibpath
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
-d, --delimiter [DELIMITER]
Output words delimiter (default: :)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects libname --help
usage: jw-pkg.py projects libname [-h] [module ...]
libname
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects list-repos --help
usage: jw-pkg.py projects list-repos [-h] [--username USERNAME]
[--askpass ASKPASS]
[--from-owner FROM_OWNER]
base_url
Query a remote GIT server for repositories
positional arguments:
base_url Base URL of all Git repositories without user part
options:
-h, --help show this help message and exit
--username USERNAME Username for SSH or HTTP authentication, don't specify
for unauthenticated (default: None)
--askpass ASKPASS Program to echo password for SSH or HTTP
authentication, don't specify for unauthenticated
(default: None)
--from-owner FROM_OWNER
List from-owner's projects (default: janware)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects modules --help
usage: jw-pkg.py projects modules [-h] [-F [FILTER]]
Query existing janware packages
options:
-h, --help show this help message and exit
-F, --filter [FILTER]
Key-value pairs, seperated by commas, to be searched
for in project.conf (default: None)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects path --help
usage: jw-pkg.py projects path [-h] [module ...]
path
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects pkg-conflicts --help
usage: jw-pkg.py projects pkg-conflicts [-h] [-S [SUBSECTIONS]]
[-d [DELIMITER]] [-p]
[--dont-strip-revision]
[--expand-semver-revision-range]
[--syntax {semver,debian,names-only}]
[--recursive]
[--dont-expand-version-macros]
[--ignore [IGNORE]] [--skip-excluded]
[--hide-self] [--hide-jw-pkg]
[--quote]
flavours [modules ...]
Print packages conflicting with a given package
positional arguments:
flavours Dependency flavours (run, build, devel, release),
separated by comma or whitespace
modules Modules (default: None)
options:
-h, --help show this help message and exit
-S, --subsections [SUBSECTIONS]
Subsections to consider, separated by comma or
whitespace (default: None)
-d, --delimiter [DELIMITER]
Output words delimiter (default: , )
-p, --no-subpackages Cut -run and -devel from package names (default:
False)
--dont-strip-revision
Always treat VERSION macro as VERSION-REVISION
(default: False)
--expand-semver-revision-range
Always treat =VERSION macro as >= VERSION-0 and <
(VERSION+1)-0 (default: False)
--syntax {semver,debian,names-only}
Output syntax (default: semver)
--recursive Find dependencies recursively (default: False)
--dont-expand-version-macros
Don't expand VERSION and REVISION macros (default:
False)
--ignore [IGNORE] Packages that should be ignored together with their
dependencies (default: )
--skip-excluded Don't consider or output modules matching the os
cascade in their [build].exclude config (default:
False)
--hide-self Don't include projects listed in <modules> in the
output (default: False)
--hide-jw-pkg Don't include packages from requires.jw in the output
(default: False)
--quote Put double quotes around each listed dependency
(default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects pkg-provides --help
usage: jw-pkg.py projects pkg-provides [-h] [-S [SUBSECTIONS]]
[-d [DELIMITER]] [-p]
[--dont-strip-revision]
[--expand-semver-revision-range]
[--syntax {semver,debian,names-only}]
[--recursive]
[--dont-expand-version-macros]
[--ignore [IGNORE]] [--skip-excluded]
[--hide-self] [--hide-jw-pkg] [--quote]
flavours [modules ...]
Print packages and capabilities provided by a given package
positional arguments:
flavours Dependency flavours (run, build, devel, release),
separated by comma or whitespace
modules Modules (default: None)
options:
-h, --help show this help message and exit
-S, --subsections [SUBSECTIONS]
Subsections to consider, separated by comma or
whitespace (default: None)
-d, --delimiter [DELIMITER]
Output words delimiter (default: , )
-p, --no-subpackages Cut -run and -devel from package names (default:
False)
--dont-strip-revision
Always treat VERSION macro as VERSION-REVISION
(default: False)
--expand-semver-revision-range
Always treat =VERSION macro as >= VERSION-0 and <
(VERSION+1)-0 (default: False)
--syntax {semver,debian,names-only}
Output syntax (default: semver)
--recursive Find dependencies recursively (default: False)
--dont-expand-version-macros
Don't expand VERSION and REVISION macros (default:
False)
--ignore [IGNORE] Packages that should be ignored together with their
dependencies (default: )
--skip-excluded Don't consider or output modules matching the os
cascade in their [build].exclude config (default:
False)
--hide-self Don't include projects listed in <modules> in the
output (default: False)
--hide-jw-pkg Don't include packages from requires.jw in the output
(default: False)
--quote Put double quotes around each listed dependency
(default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects pkg-recommends --help
usage: jw-pkg.py projects pkg-recommends [-h] [-S [SUBSECTIONS]]
[-d [DELIMITER]] [-p]
[--dont-strip-revision]
[--expand-semver-revision-range]
[--syntax {semver,debian,names-only}]
[--recursive]
[--dont-expand-version-macros]
[--ignore [IGNORE]] [--skip-excluded]
[--hide-self] [--hide-jw-pkg]
[--quote]
flavours [modules ...]
Print recommended packages
positional arguments:
flavours Dependency flavours (run, build, devel, release),
separated by comma or whitespace
modules Modules (default: None)
options:
-h, --help show this help message and exit
-S, --subsections [SUBSECTIONS]
Subsections to consider, separated by comma or
whitespace (default: None)
-d, --delimiter [DELIMITER]
Output words delimiter (default: , )
-p, --no-subpackages Cut -run and -devel from package names (default:
False)
--dont-strip-revision
Always treat VERSION macro as VERSION-REVISION
(default: False)
--expand-semver-revision-range
Always treat =VERSION macro as >= VERSION-0 and <
(VERSION+1)-0 (default: False)
--syntax {semver,debian,names-only}
Output syntax (default: semver)
--recursive Find dependencies recursively (default: False)
--dont-expand-version-macros
Don't expand VERSION and REVISION macros (default:
False)
--ignore [IGNORE] Packages that should be ignored together with their
dependencies (default: )
--skip-excluded Don't consider or output modules matching the os
cascade in their [build].exclude config (default:
False)
--hide-self Don't include projects listed in <modules> in the
output (default: False)
--hide-jw-pkg Don't include packages from requires.jw in the output
(default: False)
--quote Put double quotes around each listed dependency
(default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects pkg-requires --help
usage: jw-pkg.py projects pkg-requires [-h] [-S [SUBSECTIONS]]
[-d [DELIMITER]] [-p]
[--dont-strip-revision]
[--expand-semver-revision-range]
[--syntax {semver,debian,names-only}]
[--recursive]
[--dont-expand-version-macros]
[--ignore [IGNORE]] [--skip-excluded]
[--hide-self] [--hide-jw-pkg] [--quote]
flavours [modules ...]
Print packages required for a given package
positional arguments:
flavours Dependency flavours (run, build, devel, release),
separated by comma or whitespace
modules Modules (default: None)
options:
-h, --help show this help message and exit
-S, --subsections [SUBSECTIONS]
Subsections to consider, separated by comma or
whitespace (default: None)
-d, --delimiter [DELIMITER]
Output words delimiter (default: , )
-p, --no-subpackages Cut -run and -devel from package names (default:
False)
--dont-strip-revision
Always treat VERSION macro as VERSION-REVISION
(default: False)
--expand-semver-revision-range
Always treat =VERSION macro as >= VERSION-0 and <
(VERSION+1)-0 (default: False)
--syntax {semver,debian,names-only}
Output syntax (default: semver)
--recursive Find dependencies recursively (default: False)
--dont-expand-version-macros
Don't expand VERSION and REVISION macros (default:
False)
--ignore [IGNORE] Packages that should be ignored together with their
dependencies (default: )
--skip-excluded Don't consider or output modules matching the os
cascade in their [build].exclude config (default:
False)
--hide-self Don't include projects listed in <modules> in the
output (default: False)
--hide-jw-pkg Don't include packages from requires.jw in the output
(default: False)
--quote Put double quotes around each listed dependency
(default: False)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects proj-dir --help
usage: jw-pkg.py projects proj-dir [-h] [module ...]
Print directory of a given package
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects pythonpath --help
usage: jw-pkg.py projects pythonpath [-h] [--subdir SUBDIR]
[--delimiter DELIMITER]
[--prefix PATH_COMPONENT_PREFIX]
[module ...]
Generate PYTHONPATH for given modules
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
--subdir SUBDIR Directories to look for relative to the respective
project root directory (default: ['src/python',
'tools/python'])
--delimiter DELIMITER
Delimiter between paths (default: :)
--prefix PATH_COMPONENT_PREFIX
Prefix to prepend before every path component
(default: None)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects required-os-pkg --help
usage: jw-pkg.py projects required-os-pkg [-h] [--skip-excluded] [--quote]
[--pkg-relations PKG_RELATIONS]
flavours [modules ...]
List distribution packages required for a package
positional arguments:
flavours Dependency flavours
modules Modules (default: None)
options:
-h, --help show this help message and exit
--skip-excluded Output empty prerequisite list for excluded modules
(default: False)
--quote Put double quotes around each listed dependency
(default: False)
--pkg-relations PKG_RELATIONS
Relations between packages to take into consideration,
comma or space separated (default: requires)
============= Running: jw-pkg.py -t ../../../.. --log-level info projects summary --help
usage: jw-pkg.py projects summary [-h] [module ...]
Print summary description of given modules
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects test --help
usage: jw-pkg.py projects test [-h] blah
Test
positional arguments:
blah The blah argument
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects tmpl-dir --help
usage: jw-pkg.py projects tmpl-dir [-h] [module ...]
Print directory containing templates of a given module
positional arguments:
module Modules (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets --help
usage: jw-pkg.py secrets [-h] ...
Manage package secrets
options:
-h, --help show this help message and exit
Available subcommands of secrets:
compile-templates Compile package template files
install Install secrets from various sources as static secrets
onto the target
list-compilation-output
List package compilation output files
list-secrets List package secret files
list-templates List package template files
rm-compilation-output
Remove package compilation output files
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets compile-templates --help
usage: jw-pkg.py secrets compile-templates [-h] [--owner OWNER]
[--group GROUP] [--mode MODE]
[packages ...]
Compile package template files
positional arguments:
packages Package names (default: None)
options:
-h, --help show this help message and exit
--owner, -o OWNER Default output file owner (default: None)
--group, -g GROUP Default output file group (default: None)
--mode, -m MODE Default output file mode (octal) (default: None)
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets install --help
usage: jw-pkg.py secrets install [-h] [--only-missing] src [packages ...]
Install secrets from various sources as static secrets onto the target
positional arguments:
src URI of secret source
packages Package names (default: None)
options:
-h, --help show this help message and exit
--only-missing Install only secrets not already on the target (default:
False)
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets list-compilation-output --help
usage: jw-pkg.py secrets list-compilation-output [-h] [--all] [packages ...]
List package compilation output files
positional arguments:
packages Package names (default: None)
options:
-h, --help show this help message and exit
--all Show all output targets, including non-existent files (default:
False)
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets list-secrets --help
usage: jw-pkg.py secrets list-secrets [-h] [--all] [packages ...]
List package secret files
positional arguments:
packages Package names (default: None)
options:
-h, --help show this help message and exit
--all Show all secret paths, including non-existent files (default:
False)
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets list-templates --help
usage: jw-pkg.py secrets list-templates [-h] [packages ...]
List package template files
positional arguments:
packages Package names (default: None)
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info secrets rm-compilation-output --help
usage: jw-pkg.py secrets rm-compilation-output [-h] [packages ...]
Remove package compilation output files
positional arguments:
packages Package names (default: None)
options:
-h, --help show this help message and exit

View file

@ -0,0 +1,41 @@
#!/bin/bash
# shellcheck disable=SC2048,SC2086
# Unquoted $* and $cmds are intentional — word splitting for subcommand names
run()
{
local log_cmd
# shellcheck disable=SC2001
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
printf '============= Running: %s\n' "$log_cmd"
"$@"
}
parse_subcmds()
{
$jw_pkg_py $* --help | awk '/^ [a-z]/ {print $1}'
}
help_cmd()
{
local cmds subcommand subcommands
cmds="$*"
run $jw_pkg_py $cmds --help
subcommands=$(parse_subcmds $cmds)
for subcommand in $subcommands; do
help_cmd $cmds $subcommand
done
}
cmd_test()
{
help_cmd
}
export LC_ALL="C"
set -euo pipefail
shopt -s nullglob
jw_pkg_py="$*"
cmd_test

View file

@ -0,0 +1,4 @@
TOPDIR = ../../../..
include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/dirs.mk

View file

@ -0,0 +1,14 @@
TOPDIR = ../../../../..
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
test: test.integration.in-tree
test.integration.in-tree:
$(TEST_CMD_LINE) --interactive false packages ls bash | grep /bin/bash | sort > test.out
diff test.out.expected test.out
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f test.out

View file

@ -0,0 +1,2 @@
/usr/bin/bash
/usr/bin/bashbug

View file

@ -0,0 +1,4 @@
TOPDIR = ../../../..
include $(TOPDIR)/make/proj.mk
include $(JWBDIR)/make/dirs.mk

View file

@ -0,0 +1,29 @@
# This file runs commands typically used during initial Makefile caching.
#
# It's especially useful to run them in an explicit test, because they are used
# to fill Makefile variables, and if they fail, they leave an empty variable
# behind instead of failing the build entirely.
export JW_DEFAULT_SHOW_BACKTRACE = true
TOPDIR = ../../../../..
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
test: test.integration.in-tree
test.integration.in-tree:
$(TEST_CMD_LINE) --topdir-format absolute platform info --format "%{gnu-triplet} %{cascade}"
$(TEST_CMD_LINE) --topdir-format absolute platform info --format %{id}-%{codename}
$(TEST_CMD_LINE) --topdir-format absolute projects pkg-requires --no-subpackages --subsections=jw --syntax names-only --delimiter " " "build devel" jw-pkg
$(TEST_CMD_LINE) --topdir-format absolute projects pkg-requires --no-subpackages --subsections=jw --syntax names-only --delimiter " " run jw-pkg
$(TEST_CMD_LINE) --topdir-format absolute projects proj-dir jw-pkg
$(TEST_CMD_LINE) --topdir-format absolute projects pythonpath --delimiter " " jw-pkg
$(TEST_CMD_LINE) --topdir-format relative projects pythonpath --prefix '$$MYPY_CONFIG_FILE_DIR/' jw-pkg
$(TEST_CMD_LINE) --topdir-format unaltered projects create-file --format tmpl --template-name pyproject.toml --search-path $(TOPDIR)/conf/templates --field "mypypath=mypy_path = "$MYPY_CONFIG_FILE_DIR/src/python"" jw-pkg > test-pyproject.toml
$(TEST_CMD_LINE) --topdir-format unaltered projects create-file --format pyright --field base=./conf/project/pyrightconfig-base.json --field include=src/python jw-pkg > test-pyrightconfig.json
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f test-*.*

View file

@ -0,0 +1,23 @@
TOPDIR = ../../../../..
OUTPUT = test-out.txt
REFERENCE = test-expected.txt
# Relative topdir keeps the rendered project paths relocatable; dropping the
# log position keeps the error output free of volatile line numbers.
TEST_CMD_ARGS = --topdir-format relative --log-flags prio,stderr
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
$(OUTPUT): Makefile test.sh templates/basic.tmpl templates/list.tmpl
bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp 2>&1
diff $(REFERENCE) $(OUTPUT).tmp
mv $(OUTPUT).tmp $(OUTPUT)
test: $(OUTPUT)
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f $(OUTPUT) $(OUTPUT).tmp

View file

@ -0,0 +1,2 @@
name={name}
path={path}

View file

@ -0,0 +1 @@
start={items}end

View file

@ -0,0 +1,55 @@
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name basic.tmpl --search-path templates --field name=foo jw-pkg
name=foo
path={path}
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name list.tmpl --search-path templates --field items=a --field items=b jw-pkg
start=a,
start=bend
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name list.tmpl --search-path templates --field items=a --field items=b --field-separator | jw-pkg
start=a|bend
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name list.tmpl --search-path templates --field items=a --field items=b --field-separator %n jw-pkg
start=a
start=bend
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name list.tmpl --search-path templates --field items=a --field items=b --quote --field-separator | jw-pkg
start="a"|"b"end
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name basic.tmpl --search-path templates --field-keys name,path --field name=foo jw-pkg
name=foo
path=
============= Running: jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format pyright --field base=./conf/project/pyrightconfig-base.json --field include=src/python jw-pkg
{
"extends": "./conf/project/pyrightconfig-base.json",
"include": [
"src/python"
],
"exclude": [
"**/__pycache__",
"**/.pytest_cache",
"**/.mypy_cache",
"**/.ruff_cache",
"**/.venv",
"**/build",
"**/dist"
],
"extraPaths": [
"src/python"
],
"typeCheckingMode": "basic",
"pythonPlatform": "Linux"
}
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl jw-pkg
<E> Failed: Can't render template without name
============= Exit status: 1
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name nosuch.tmpl --search-path templates jw-pkg
<E> Failed: Failed to find template "nosuch.tmpl"
============= Exit status: 1
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name basic.tmpl --search-path templates --field-keys name --field path=x jw-pkg
<E> Failed: The following keys in --field are not in --field-keys: path
============= Exit status: 1
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format pyright --field base=x --field include=y --field-separator | jw-pkg
<E> Failed: Unsupported separator for pyright config: "|"
============= Exit status: 1
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format bogus jw-pkg
jw-pkg.py projects create-file: error: argument --format: invalid choice: 'bogus' (choose from 'pyright', 'tmpl')
============= Exit status: 2
============= Running (expect failure): jw-pkg.py -t ../../../../.. --log-level info --topdir-format relative --log-flags prio,stderr projects create-file --format tmpl --template-name basic.tmpl --search-path templates --field noval jw-pkg
jw-pkg.py projects create-file: error: argument -f/--field: Expected KEY=VALUE
============= Exit status: 2

View file

@ -0,0 +1,108 @@
#!/bin/bash
# shellcheck disable=SC2048,SC2086
# Unquoted $* is intentional — the jw-pkg command line
export LC_ALL="C"
set -euo pipefail
jw_pkg_py="$*"
# Print a header and run a command whose output is part of the expected
# result. Under `set -e` a non-zero exit aborts the test.
run()
{
local log_cmd
# shellcheck disable=SC2001
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
printf '============= Running: %s\n' "$log_cmd"
"$@"
}
# Run a command that must exit non-zero and report the given message. Prints
# the command, the resulting error message, and the observed exit status.
# Fails the test if the command unexpectedly succeeds or the message is
# missing. Only the last output line is shown: for the app-level errors it is
# the error itself, and for argparse rejections it is the error line, which
# keeps the expected file free of the volatile usage text.
expect_fail()
{
local expected out rc log_cmd
expected=$1
shift
# shellcheck disable=SC2001
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
printf '============= Running (expect failure): %s\n' "$log_cmd"
set +e
out=$("$@" 2>&1)
rc=$?
set -e
printf '%s\n' "$(tail -n 1 <<<"$out")"
printf '============= Exit status: %s\n' "$rc"
if [ "$rc" -eq 0 ]; then
echo "ERROR: expected failure, but the command succeeded" >&2
return 1
fi
if ! grep -qF -- "$expected" <<<"$out"; then
echo "ERROR: expected message not found: $expected" >&2
return 1
fi
}
cmd_test()
{
# -- tmpl: substitute a field; a marker without a value stays literal
run $jw_pkg_py projects create-file --format tmpl \
--template-name basic.tmpl --search-path templates \
--field name=foo jw-pkg
# -- tmpl: multi-value field, default separator (comma, newline)
run $jw_pkg_py projects create-file --format tmpl \
--template-name list.tmpl --search-path templates \
--field items=a --field items=b jw-pkg
# -- tmpl: multi-value field, custom separator
run $jw_pkg_py projects create-file --format tmpl \
--template-name list.tmpl --search-path templates \
--field items=a --field items=b --field-separator '|' jw-pkg
# -- tmpl: multi-value field, "%n" separator
run $jw_pkg_py projects create-file --format tmpl \
--template-name list.tmpl --search-path templates \
--field items=a --field items=b --field-separator '%n' jw-pkg
# -- tmpl: multi-value field, quoted values
run $jw_pkg_py projects create-file --format tmpl \
--template-name list.tmpl --search-path templates \
--field items=a --field items=b --quote --field-separator '|' jw-pkg
# -- tmpl: --field-keys adds keys that were not passed as empty fields
run $jw_pkg_py projects create-file --format tmpl \
--template-name basic.tmpl --search-path templates \
--field-keys name,path --field name=foo jw-pkg
# -- pyright: built-in template, extra paths from project metadata
run $jw_pkg_py projects create-file --format pyright \
--field base=./conf/project/pyrightconfig-base.json \
--field include=src/python jw-pkg
# -- errors
expect_fail "Can't render template without name" \
$jw_pkg_py projects create-file --format tmpl jw-pkg
expect_fail 'Failed to find template "nosuch.tmpl"' \
$jw_pkg_py projects create-file --format tmpl \
--template-name nosuch.tmpl --search-path templates jw-pkg
expect_fail "not in --field-keys: path" \
$jw_pkg_py projects create-file --format tmpl \
--template-name basic.tmpl --search-path templates \
--field-keys name --field path=x jw-pkg
expect_fail 'Unsupported separator for pyright config: "|"' \
$jw_pkg_py projects create-file --format pyright \
--field base=x --field include=y --field-separator '|' jw-pkg
expect_fail "invalid choice: 'bogus'" \
$jw_pkg_py projects create-file --format bogus jw-pkg
expect_fail "Expected KEY=VALUE" \
$jw_pkg_py projects create-file --format tmpl \
--template-name basic.tmpl --search-path templates --field noval jw-pkg
}
cmd_test

View file

@ -0,0 +1,19 @@
TOPDIR = ../../../../..
OUTPUT = test-out.txt
REFERENCE = test-expected.txt
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
$(OUTPUT): Makefile test.sh
bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp
diff $(REFERENCE) $(OUTPUT).tmp
mv $(OUTPUT).tmp $(OUTPUT)
test: $(OUTPUT)
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f $(OUTPUT) $(OUTPUT).tmp

View file

@ -0,0 +1,31 @@
============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -s jw-pkg test -p /usr -v 1.0 --cflags=-I/usr/include --libflags=-L/usr/lib -ljw-pkg -r jw-core >= 1.0, jw-base -R jw-devel
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description: jw-pkg test
Version: 1.0
Cflags: -I/usr/include
Libs: -L/usr/lib -ljw-pkg
Requires: jw-core >= 1.0, jw-base
Requires.private: jw-devel============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -p /usr -v 1.0 -r foo bar>=2.0, baz
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description:
Version: 1.0
Requires: foo, bar >= 2.0, baz============= Running: jw-pkg.py -t ../../../../.. --log-level info projects create-pkg-config -n jw-pkg -p /usr -v 1.0 -R qux
prefix = /usr
exec_prefix = ${prefix}
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
Name: jw-pkg
Description:
Version: 1.0
Requires.private: qux

View file

@ -0,0 +1,28 @@
#!/bin/bash
# shellcheck disable=SC2048,SC2086
# Unquoted $* is intentional — the jw-pkg command line
export LC_ALL="C"
set -euo pipefail
jw_pkg_py="$*"
run()
{
local log_cmd
# shellcheck disable=SC2001
log_cmd=$(echo "$*" | sed 's|.*python3[0-9.]*\s\+\(\.\.\/\)*scripts/||')
printf '============= Running: %s\n' "$log_cmd"
"$@"
}
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -s 'jw-pkg test' -p /usr -v 1.0 \
--cflags=-I/usr/include --libflags=-L/usr/lib\ -ljw-pkg \
-r 'jw-core >= 1.0, jw-base' -R 'jw-devel'
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -p /usr -v 1.0 -r 'foo bar>=2.0, baz'
run $jw_pkg_py projects create-pkg-config \
-n jw-pkg -p /usr -v 1.0 -R 'qux'

View file

@ -0,0 +1,28 @@
TOPDIR = ../../../../..
OUTPUT = test-out.txt
REFERENCE = test-expected.txt
# Relative topdir keeps the rendered project paths relocatable; dropping the
# log position keeps the error output free of volatile line numbers. The
# fixture tree under ./proj provides the topdir and the projects root; the
# last -t wins over the global one.
TEST_CMD_ARGS = --topdir-format relative --log-flags prio,stderr \
-t ./proj/excl-never -p ./proj
include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk
all:
$(OUTPUT): Makefile test.sh \
$(wildcard proj/*) $(wildcard proj/*/make/project.conf) \
$(wildcard proj/*/VERSION)
bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp 2>&1
diff $(REFERENCE) $(OUTPUT).tmp
mv $(OUTPUT).tmp $(OUTPUT)
test: $(OUTPUT)
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
rm -f $(OUTPUT) $(OUTPUT).tmp

View file

@ -0,0 +1 @@
1.0.0-1

View file

@ -0,0 +1,10 @@
[summary]
Test fixture: plain dependency target
[description]
Fixture for pkg-requires --skip-excluded: a project without [build]
exclude.
[global]
group = "Testing"
subpackages = run

Some files were not shown because too many files have changed in this diff Show more