Skip to content

Commit a1153c4

Browse files
committed
fix: _metadata import works outside of module
1 parent 84c18f7 commit a1153c4

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

DynamicVector/DynamicVector.py

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,34 @@
1414
__copyright__,
1515
)
1616
except ImportError:
17-
__version__ = "Failed to load from _metadata.py"
18-
__author__ = __version__
19-
__email__ = __version__
20-
__license__ = __version__
21-
__status__ = __version__
22-
__maintainer__ = __version__
23-
__credits__ = __version__
24-
__url__ = __version__
25-
__description__ = __version__
26-
__copyright__ = __version__
17+
try:
18+
from _metadata import (
19+
__version__,
20+
__author__,
21+
__email__,
22+
__license__,
23+
__status__,
24+
__maintainer__,
25+
__credits__,
26+
__url__,
27+
__description__,
28+
__copyright__,
29+
)
30+
except ImportError:
31+
# _metadata.py failed to load,
32+
# fill in with dummy values (script may be standalone)
33+
__version__ = "Failed to load from _metadata.py"
34+
__author__ = __version__
35+
__email__ = __version__
36+
__license__ = __version__
37+
__status__ = __version__
38+
__maintainer__ = __version__
39+
__credits__ = __version__
40+
__url__ = __version__
41+
__description__ = __version__
42+
__copyright__ = __version__
43+
44+
# %% --------------------------------------------------------------------------
2745

2846
__all__ = [
2947
"DynamicVector",

0 commit comments

Comments
 (0)