Skip to content

Commit 05cd1c1

Browse files
committed
Fixed error when package downloaded from tarball instead of cloned
1 parent d50f448 commit 05cd1c1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

setup.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,25 @@
22

33
import glob
44
import git
5+
from git import InvalidGitRepositoryError
56

67
from setuptools import find_namespace_packages, setup
78
from pathlib import Path
89

910
scripts = sorted(glob.glob('bin/picca*'))
1011

11-
description = (f"Package for Igm Cosmological-Correlations Analyses\n"
12-
f"commit hash: {git.Repo('.').head.object.hexsha}")
12+
exec(open('py/picca/_version.py').read())
13+
version = __version__
14+
15+
try:
16+
description = (f"Package for Igm Cosmological-Correlations Analyses\n"
17+
f"commit hash: {git.Repo('.').head.object.hexsha}")
18+
except InvalidGitRepositoryError:
19+
description = (f"Package for Igm Cosmological-Correlations Analyses\n"
20+
f"version: {version}")
1321
this_directory = Path(__file__).parent
1422
long_description = (this_directory / "README.md").read_text()
1523

16-
exec(open('py/picca/_version.py').read())
17-
version = __version__
1824

1925
setup(name="picca",
2026
version = version,

0 commit comments

Comments
 (0)