diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml index af54411..65ab979 100644 --- a/.github/workflows/autorelease.yml +++ b/.github/workflows/autorelease.yml @@ -29,17 +29,15 @@ jobs: run: sudo apt-get install -y libkrb5-dev - name: Installs dev deps and package - run : | - pdm export -f requirements --without-hashes --dev > requirements.txt - python3.12 -m pip install -r requirements.txt + run : PDM_BUILD_SCM_VERSION=$(cat VERSION) pdm install --dev - name: Build binary release run: | - python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py + pdm run python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py mv ldeep.bin ldeep_linux-amd64 - name: Build Source Distribution - run: pdm build -d sdist --no-wheel + run: PDM_BUILD_SCM_VERSION=$(cat VERSION) pdm build -d sdist --no-wheel - name: Upload Artifacts (binary) uses: actions/upload-artifact@v4 @@ -65,13 +63,11 @@ jobs: run: python3 -m pip install pdm - name: Installs dev deps and package - run: | - pdm export -f requirements --without-hashes --dev > requirements.txt - python3 -m pip install -r requirements.txt + run: PDM_BUILD_SCM_VERSION=$(cat VERSION) pdm install --dev - name: Build run: | - python3 -m nuitka --standalone --assume-yes-for-downloads --output-filename=ldeep.exe --onefile ldeep/__main__.py + pdm run python3 -m nuitka --standalone --assume-yes-for-downloads --output-filename=ldeep.exe --onefile ldeep/__main__.py mv ldeep.exe ldeep_windows-amd64.exe - name: Upload Artifacts uses: actions/upload-artifact@v4 @@ -92,13 +88,11 @@ jobs: run: python3.12 -m pip install pdm - name: Installs dev deps and package - run: | - pdm export -f requirements --without-hashes --dev > requirements.txt - python3.12 -m pip install -r requirements.txt + run: PDM_BUILD_SCM_VERSION=$(cat VERSION) pdm install --dev - name: Build run: | - python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py + pdm run python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py mv ldeep.bin ldeep_macos-arm64 - name: Upload Artifacts @@ -120,13 +114,11 @@ jobs: run: python3.12 -m pip install pdm - name: Installs dev deps and package - run: | - pdm export -f requirements --without-hashes --dev > requirements.txt - python3.12 -m pip install -r requirements.txt + run: PDM_BUILD_SCM_VERSION=$(cat VERSION) pdm install --dev - name: Build run: | - python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py + pdm run python3.12 -m nuitka --standalone --onefile --output-filename=ldeep.bin ldeep/__main__.py mv ldeep.bin ldeep_macos-amd64 - name: Upload Artifacts diff --git a/.gitignore b/.gitignore index 8e9256a..d50c564 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ __pycache__ .venv .pdm-python .pdm-build/ +ldeep/_version.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 510b4af..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include VERSION -include requirements.txt diff --git a/Makefile b/Makefile index 2815ce7..061de47 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,14 @@ -EXEC = ldeep.bin - SRC = $(wildcard ./ldeep/*.py) -all: $(EXEC) +all: build -$(EXEC): $(SRC) - pdm build --no-sdist - pex -r requirements.txt --disable-cache -f dist/ -o $@ -e ldeep.__main__ ldeep +build: + pdm build -d sdist pypi: $(SRC) - pdm build -d sdist --no-wheel twine upload sdist/* pypi-test: $(SRC) - pdm build -d sdist --no-wheel twine upload --repository testpypi sdist/* clean: @@ -28,4 +23,4 @@ export: pdm export -f requirements --without-hashes --prod > requirements.txt pdm export -f requirements --without-hashes --dev > requirements-dev.txt -.PHONY: clean mrproper +.PHONY: clean mrproper build diff --git a/ldeep/__init__.py b/ldeep/__init__.py index 1a8ced9..e69de29 100644 --- a/ldeep/__init__.py +++ b/ldeep/__init__.py @@ -1,7 +0,0 @@ -import os - -__version__ = open(os.path.join(os.path.dirname(__file__), "../VERSION")).read().strip() - - -def get_version(): - return __version__ diff --git a/ldeep/__main__.py b/ldeep/__main__.py index 52fac5e..e7b1210 100755 --- a/ldeep/__main__.py +++ b/ldeep/__main__.py @@ -23,7 +23,7 @@ FILETIME_TIMESTAMP_FIELDS, FOREST_LEVELS, ) -from ldeep import __version__ +from ldeep._version import __version__ from ldeep.views.ldap_activedirectory import LdapActiveDirectoryView from ldeep.views.cache_activedirectory import CacheActiveDirectoryView @@ -1756,12 +1756,7 @@ def action_create_user(self, kwargs): def main(): - parser = ArgumentParser() - parser.add_argument( - "--version", - action="version", - version="%(prog)s {version}".format(version=__version__), - ) + parser = ArgumentParser(f"ldeep - {__version__}") parser.add_argument( "-o", "--outfile", default="", help="Store the results in a file" ) diff --git a/pyproject.toml b/pyproject.toml index 5532e95..2f3ebab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,15 +36,10 @@ classifiers = [ "Topic :: Security", ] -[tool.pdm.build] -includes = [ - "ldeep/**/*.py", - "VERSION", -] - [tool.pdm.version] -source = "call" -getter = "ldeep:get_version" +source = "scm" +write_to = "ldeep/_version.py" +write_template = "__version__ = '{}'" [project.urls] Homepage = "https://github.com/franc-pentest/ldeep" diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 02d28f2..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,61 +0,0 @@ -# This file is @generated by PDM. -# Please do not edit it manually. - -asn1crypto==1.5.1 -backports-tarfile==1.2.0; python_version < "3.12" -black==24.4.2 -certifi==2024.6.2 -cffi==1.16.0 -charset-normalizer==3.3.2 -click==8.1.7 -colorama==0.4.6; platform_system == "Windows" -commandparse==1.1.2 -cryptography==42.0.7 -decorator==5.1.1 -dnspython==2.6.1 -docutils==0.20.1 -gssapi==1.8.3 -idna==3.7 -importlib-metadata==7.1.0 -importlib-resources==6.4.0; python_version < "3.9" -jaraco-classes==3.4.0 -jaraco-context==5.3.0 -jaraco-functools==4.0.1 -jeepney==0.8.0; sys_platform == "linux" -keyring==25.2.1 -ldap3==2.9.1 -markdown-it-py==3.0.0 -mdurl==0.1.2 -more-itertools==10.2.0 -mypy-extensions==1.0.0 -nh3==0.2.17 -nuitka==2.3 -ordered-set==4.1.0 -oscrypto==1.3.0 -packaging==24.0 -pathspec==0.12.1 -pex==2.3.1 -pkginfo==1.11.0 -platformdirs==4.2.2 -pyasn1==0.6.0 -pycparser==2.22 -pycryptodome==3.20.0 -pycryptodomex==3.20.0 -pygments==2.18.0 -pywin32-ctypes==0.2.2; sys_platform == "win32" -readme-renderer==43.0 -requests==2.32.3 -requests-toolbelt==1.0.0 -rfc3986==2.0.0 -rich==13.7.1 -secretstorage==3.3.3; sys_platform == "linux" -six==1.16.0 -termcolor==2.4.0 -tomli==2.0.1; python_version < "3.11" -tqdm==4.66.4 -twine==5.1.0 -typing-extensions==4.12.1; python_version < "3.11" -urllib3==2.2.1 -zipp==3.19.1 -zstandard==0.22.0 - diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index afb911f..0000000 --- a/requirements.txt +++ /dev/null @@ -1,21 +0,0 @@ -# This file is @generated by PDM. -# Please do not edit it manually. - -asn1crypto==1.5.1 -cffi==1.16.0 -colorama==0.4.6; platform_system == "Windows" -commandparse==1.1.2 -cryptography==42.0.7 -decorator==5.1.1 -dnspython==2.6.1 -gssapi==1.8.3 -ldap3==2.9.1 -oscrypto==1.3.0 -pyasn1==0.6.0 -pycparser==2.22 -pycryptodome==3.20.0 -pycryptodomex==3.20.0 -six==1.16.0 -termcolor==2.4.0 -tqdm==4.66.4 -