diff --git a/.gitignore b/.gitignore index 02d5097..eb7160f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,5 @@ __pycache__/ /.env /MANIFEST /_meta.py -/archive/__init__.py /build/ /dist/ diff --git a/Makefile b/Makefile index 21b9cc5..b71cf2f 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,6 @@ clean: distclean: clean rm -f MANIFEST _meta.py - rm -f archive/__init__.py rm -rf dist rm -rf tests/.pytest_cache diff --git a/setup.py b/setup.py index e9a3037..e6741a0 100644 --- a/setup.py +++ b/setup.py @@ -37,43 +37,22 @@ class meta(setuptools.Command): description = "generate meta files" user_options = [] - init_template = '''"""%(doc)s""" - -__version__ = "%(version)s" - -from archive.archive import Archive -from archive.exception import * -''' meta_template = ''' version = "%(version)s" ''' def initialize_options(self): - self.package_dir = None + pass def finalize_options(self): - self.package_dir = {} - if self.distribution.package_dir: - for name, path in self.distribution.package_dir.items(): - self.package_dir[name] = convert_path(path) + pass def run(self): version = self.distribution.get_version() log.info("version: %s", version) values = { 'version': version, - 'doc': docstring, } - try: - pkgname = self.distribution.packages[0] - except IndexError: - log.warn("warning: no package defined") - else: - pkgdir = Path(self.package_dir.get(pkgname, pkgname)) - if not pkgdir.is_dir(): - pkgdir.mkdir() - with (pkgdir / "__init__.py").open("wt") as f: - print(self.init_template % values, file=f) with Path("_meta.py").open("wt") as f: print(self.meta_template % values, file=f) @@ -139,6 +118,7 @@ def run(self): Download="https://github.com/RKrahl/archive-tools/releases/latest", ), packages = ["archive", "archive.cli", "archive.bt"], + package_dir = {"": "src"}, python_requires = ">=3.6", install_requires = ["PyYAML", "packaging", "lark"], scripts = ["scripts/archive-tool.py", "scripts/backup-tool.py", diff --git a/src/archive/__init__.py b/src/archive/__init__.py new file mode 100644 index 0000000..0022c66 --- /dev/null +++ b/src/archive/__init__.py @@ -0,0 +1,11 @@ +"""Tools for managing archives + +This package provides tools for managing archives. An archive in +terms of this package is a (compressed) tar archive file with some +embedded metadata on the included files. This metadata include the +name, file stats, and checksums of the file. +""" + +from ._meta import version as __version__ +from .archive import Archive +from .exception import * diff --git a/archive/archive.py b/src/archive/archive.py similarity index 100% rename from archive/archive.py rename to src/archive/archive.py diff --git a/archive/bt/__init__.py b/src/archive/bt/__init__.py similarity index 100% rename from archive/bt/__init__.py rename to src/archive/bt/__init__.py diff --git a/archive/bt/config.py b/src/archive/bt/config.py similarity index 100% rename from archive/bt/config.py rename to src/archive/bt/config.py diff --git a/archive/bt/create.py b/src/archive/bt/create.py similarity index 100% rename from archive/bt/create.py rename to src/archive/bt/create.py diff --git a/archive/bt/index.py b/src/archive/bt/index.py similarity index 100% rename from archive/bt/index.py rename to src/archive/bt/index.py diff --git a/archive/bt/schedule.py b/src/archive/bt/schedule.py similarity index 100% rename from archive/bt/schedule.py rename to src/archive/bt/schedule.py diff --git a/archive/cli/__init__.py b/src/archive/cli/__init__.py similarity index 100% rename from archive/cli/__init__.py rename to src/archive/cli/__init__.py diff --git a/archive/cli/check.py b/src/archive/cli/check.py similarity index 100% rename from archive/cli/check.py rename to src/archive/cli/check.py diff --git a/archive/cli/create.py b/src/archive/cli/create.py similarity index 100% rename from archive/cli/create.py rename to src/archive/cli/create.py diff --git a/archive/cli/diff.py b/src/archive/cli/diff.py similarity index 100% rename from archive/cli/diff.py rename to src/archive/cli/diff.py diff --git a/archive/cli/find.py b/src/archive/cli/find.py similarity index 100% rename from archive/cli/find.py rename to src/archive/cli/find.py diff --git a/archive/cli/info.py b/src/archive/cli/info.py similarity index 100% rename from archive/cli/info.py rename to src/archive/cli/info.py diff --git a/archive/cli/ls.py b/src/archive/cli/ls.py similarity index 100% rename from archive/cli/ls.py rename to src/archive/cli/ls.py diff --git a/archive/cli/verify.py b/src/archive/cli/verify.py similarity index 100% rename from archive/cli/verify.py rename to src/archive/cli/verify.py diff --git a/archive/config.py b/src/archive/config.py similarity index 100% rename from archive/config.py rename to src/archive/config.py diff --git a/archive/exception.py b/src/archive/exception.py similarity index 100% rename from archive/exception.py rename to src/archive/exception.py diff --git a/archive/index.py b/src/archive/index.py similarity index 100% rename from archive/index.py rename to src/archive/index.py diff --git a/archive/mailarchive.py b/src/archive/mailarchive.py similarity index 100% rename from archive/mailarchive.py rename to src/archive/mailarchive.py diff --git a/archive/manifest.py b/src/archive/manifest.py similarity index 100% rename from archive/manifest.py rename to src/archive/manifest.py diff --git a/archive/tools.py b/src/archive/tools.py similarity index 100% rename from archive/tools.py rename to src/archive/tools.py