Skip to content

Commit 0ef8499

Browse files
committed
Remove eval from setup.py, use absolute paths
1 parent 6fc006d commit 0ef8499

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
import re
88
import sys
9-
from os.path import abspath, join
9+
from os.path import abspath, dirname, join
1010
from distutils.core import setup
1111

1212

13+
SETUP_PY_DIR = dirname(abspath(__file__))
14+
1315
# read version from constructor/__init__.py
14-
pat = re.compile(r'__version__\s*=\s*(\S+)', re.M)
15-
data = open(join('constructor', '__init__.py')).read()
16-
version = eval(pat.search(data).group(1))
16+
data = open(join(SETUP_PY_DIR, "constructor", "__init__.py")).read()
17+
version = re.search(r"^__version__\s*=\s*(['\"])(\S*)\1", data, re.M).group(2)
1718

1819
setup(
1920
name = "constructor",
@@ -23,7 +24,7 @@
2324
url = "https://github.com/conda/constructor",
2425
license = "BSD",
2526
description = "create installer from conda packages",
26-
long_description = open('README.md').read(),
27+
long_description = open(join(SETUP_PY_DIR, 'README.md')).read(),
2728
packages = ['constructor', 'constructor.tests'],
2829
scripts = ['bin/constructor'],
2930
)

0 commit comments

Comments
 (0)