diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad19bf6..84c8bac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: branches: main paths: - - 'VERSION' + - 'src/secmlt/VERSION' jobs: build: diff --git a/docs/source/conf.py b/docs/source/conf.py index d931ffd..59f566d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,7 +18,8 @@ author = "Maura Pintor, Luca Demetrio" -version_path = pathlib.Path(__file__).parent.parent.parent / "VERSION" +version_path = pathlib.Path(__file__).parent.parent.parent / "src/secmlt" / "VERSION" + # Get the version file from VERSION file with version_path.open() as f: diff --git a/setup.py b/setup.py index 518aadb..5c6cd9f 100644 --- a/setup.py +++ b/setup.py @@ -2,16 +2,18 @@ from setuptools import find_packages, setup -readme = pathlib.Path(__file__).parent.resolve() / "README.md" -version = pathlib.Path(__file__).parent.resolve() / "VERSION" +here = pathlib.Path.cwd() +readme_path = here / "README.md" +version_path = here / "src/secmlt" / "VERSION" + # Get the long description from the README file -with readme.open() as f: +with readme_path.open() as f: long_description = f.read() -# Get the version file from VERSION file -with version.open() as f: - version_nr = f.read() +# Get the version from VERSION file +with version_path.open() as f: + version = f.read() CLASSIFIERS = """\ @@ -34,7 +36,7 @@ setup( name="secml-torch", - version=version_nr, + version=version, description="SecML-Torch Library", classifiers=[_f for _f in CLASSIFIERS.split("\n") if _f], long_description=long_description, @@ -49,6 +51,7 @@ "tests", ], ), + data_files=[("src/secmlt/VERSION", ["src/secmlt/VERSION"])], include_package_data=True, url="https://secml-torch.readthedocs.io/en/latest/", license="MIT", diff --git a/VERSION b/src/secmlt/VERSION similarity index 100% rename from VERSION rename to src/secmlt/VERSION diff --git a/src/secmlt/__init__.py b/src/secmlt/__init__.py index cc4eacf..7c7872a 100644 --- a/src/secmlt/__init__.py +++ b/src/secmlt/__init__.py @@ -2,7 +2,7 @@ import pathlib -version_path = pathlib.Path(__file__).parent.parent.parent / "VERSION" +version_path = pathlib.Path(__file__).parent / "VERSION" with version_path.open() as f: __version__ = f.read()