Skip to content
Snippets Groups Projects
Commit 97326605 authored by Pierre Lalet's avatar Pierre Lalet Committed by GitHub
Browse files

Merge pull request #373 from 6WIND/gitarchive-version

fix version when installing from git archive
parents 4a37721d 9d6409e7
No related branches found
No related tags found
No related merge requests found
scapy/__init__.py export-subst
......@@ -71,7 +71,17 @@ def _version():
tag = f.read()
return tag
except:
return 'unknown.version'
# Rely on git archive "export-subst" git attribute.
# See 'man gitattributes' for more details.
git_archive_id = '$Format:%h %d$'
sha1 = git_archive_id.strip().split()[0]
match = re.search(r'tag:(\S+)', git_archive_id)
if match:
return match.group(1)
elif sha1:
return sha1
else:
return 'unknown.version'
VERSION = _version()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment