RFE: refactor project paths for cleaner code
Currently, various project paths are available as Project
variables:
# package templates: distro/pkg
self.templates_path = self.input_path / 'pkg'
# package tests: distro/tests
self.tests_path = self.input_path / 'tests'
# package tests extras: distro/tests/extra
self.tests_extras_path = self.tests_path / 'extra'
# archives: pkg/archives/{dev,upstream,unpacked}
self.archive_path = self.output_path / 'archives'
self.dev_archive_path = self.archive_path / 'dev'
self.upstream_archive_path = self.archive_path / 'upstream'
self.unpacked_archive_path = self.archive_path / 'unpacked'
# build: pkg/build/{src-,}pkg
self.build_path = self.output_path / 'build'
self.package_build_path = self.build_path / 'pkgs'
self.srcpkg_build_path = self.build_path / 'srcpkgs'
# output: pkg/{src-,}pkg
self.package_out_path = self.output_path / 'pkgs'
self.srcpkg_out_path = self.output_path / 'srcpkgs'
# cache: pkg/.cache.json
self.cache_path = self.output_path / '.cache.json'
This results in too-many-instance-attributes
pylint
warning, so it might be better to manage them under a shared paths
variable, possibly new ProjectPaths
class.
As this will require refactoring, it might be a good opportunity to also make paths configurable with the help of jinja
:
[project.paths]
output = "pkg"
templates = "{{ input }}/pkg"
tests = "{{ input }}/tests"
tests_extras = "{{ tests }}/extra"
archive = "{{ output }}/archives"
dev_archive = "{{ archive }}/dev"
upstream_archive = "{{ archive }}/upstream"
unpacked_archive = "{{ archive }}/unpacked"
build = "{{ output }}/build"
package_build = "{{ build }}/pkgs"
srcpkg_build = "{{ build }}/srcpkgs"
package_out = "{{ output }}/pkgs"
srcpkg_out = "{{ output }}/srcpkgs"
cache = "{{ output }}/.cache.json"
Edited by Jakub Ružička