f4pga/setup: do not fail when installing tarballs having git available
This commit is contained in:
parent
865c1fda41
commit
c6a4e2fd08
|
@ -20,7 +20,7 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
from shutil import which
|
from shutil import which
|
||||||
from subprocess import check_output
|
from subprocess import run
|
||||||
|
|
||||||
from setuptools import setup as setuptools_setup
|
from setuptools import setup as setuptools_setup
|
||||||
|
|
||||||
|
@ -52,12 +52,17 @@ def get_requirements(file: Path) -> List[str]:
|
||||||
return requirements
|
return requirements
|
||||||
|
|
||||||
|
|
||||||
version="0.0.0"
|
semver = "0.0.0"
|
||||||
|
version = None
|
||||||
|
|
||||||
git = which('git')
|
git = which('git')
|
||||||
if git is not None:
|
if git is not None:
|
||||||
sha = check_output(['git', 'rev-parse', 'HEAD']).decode('utf8')
|
proc = run(['git', 'rev-parse', 'HEAD'], capture_output=True)
|
||||||
version += f'-{sha[0:8]}'
|
if proc.returncode == 0:
|
||||||
|
version = f'{semver}-{proc.stdout.decode("utf8")[0:8]}'
|
||||||
|
|
||||||
|
if version is None:
|
||||||
|
version = semver
|
||||||
|
|
||||||
sf = "symbiflow"
|
sf = "symbiflow"
|
||||||
shwrappers = "f4pga.wrappers.sh.__init__"
|
shwrappers = "f4pga.wrappers.sh.__init__"
|
||||||
|
|
Loading…
Reference in New Issue