diff options
author | Malfurious <m@lfurio.us> | 2025-01-04 23:57:16 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2025-01-04 23:57:16 -0500 |
commit | 23c750d2edc712c4a37e0774049a1a0f9a966009 (patch) | |
tree | e16b9f6495776dccc2c8e39d29b66d28d94b3448 /hooks | |
parent | 640726aa11369d328c1cdfe00b4344b6a925729c (diff) | |
parent | 831fd7402cd357a79b76007471722a243ec60c8d (diff) | |
download | nsploit-23c750d2edc712c4a37e0774049a1a0f9a966009.tar.gz nsploit-23c750d2edc712c4a37e0774049a1a0f9a966009.zip |
Merge branch 'nsploit'
Rename fork to nsploit and touch up project files. We switch from
automatically obtaining version via git-describe to a static definition
in pyproject.toml, to support more install use-cases.
* nsploit:
Update pyproject file for nsploit
Don't rely on git for version information
main: Update ASCII banner for nsploit
Rename sploit package to nsploit
Diffstat (limited to 'hooks')
-rw-r--r-- | hooks/bake_version.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/hooks/bake_version.py b/hooks/bake_version.py deleted file mode 100644 index 4d43228..0000000 --- a/hooks/bake_version.py +++ /dev/null @@ -1,26 +0,0 @@ -from hatchling.builders.hooks.plugin.interface import BuildHookInterface - -import os -import re - -filename = os.path.normpath(os.path.join("sploit","__init__.py")) - -#put the file back when the build ends -class RestoreVersionFile: - def __init__(self,contents): - self.contents = contents - def __del__(self): - with open(filename,"w") as f: - f.write(self.contents) - -class BakeVersionBuildHook(BuildHookInterface): - def initialize(self,version,build_data): - with open(filename,"r") as f: - self.restore = RestoreVersionFile(f.read()) - pattern = r'(?i)^__version__ *= *(?P<version>.+?)$' - match = re.search(pattern, self.restore.contents, flags=re.MULTILINE) - if not match: - raise ValueError("regex of version file failed") - span = match.span('version') - with open(filename,"w") as f: - f.write(f'{self.restore.contents[:span[0]]}"v{self.metadata.version}"{self.restore.contents[span[1]:]}') |