Skip to content

Commit d10ab02

Browse files
committed
Check for --rj-include-dir earlier
This targets issue #110, and fixups commit c4df408: I'm quite surprised that this went unnoticed when I closed issue #60... sorry.
1 parent ab10353 commit d10ab02

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

setup.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# :Author: Ken Robbins <ken@kenrobbins.com>
44
# :License: MIT License
55
# :Copyright: © 2015 Ken Robbins
6-
# :Copyright: © 2016, 2017 Lele Gaifax
6+
# :Copyright: © 2016, 2017, 2018 Lele Gaifax
77
#
88

99
import os.path
@@ -29,11 +29,19 @@
2929

3030
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
3131

32-
if not os.path.isdir(os.path.join(ROOT_PATH, 'rapidjson', 'include')):
33-
raise RuntimeError("RapidJSON sources not found: if you cloned the git repository,"
34-
" you should initialize the rapidjson submodule as explained in"
35-
" the README.rst; in all other cases you may want to report the"
36-
" issue.")
32+
rj_include_dir = './rapidjson/include'
33+
34+
for idx, arg in enumerate(sys.argv[:]):
35+
if arg.startswith('--rj-include-dir='):
36+
sys.argv.pop(idx)
37+
rj_include_dir = arg.split('=', 1)[1]
38+
break
39+
else:
40+
if not os.path.isdir(os.path.join(ROOT_PATH, 'rapidjson', 'include')):
41+
raise RuntimeError("RapidJSON sources not found: if you cloned the git"
42+
" repository, you should initialize the rapidjson submodule"
43+
" as explained in the README.rst; in all other cases you may"
44+
" want to report the issue.")
3745

3846
with open('version.txt', encoding='utf-8') as f:
3947
VERSION = f.read()
@@ -44,14 +52,6 @@
4452
with open('CHANGES.rst', encoding='utf-8') as f:
4553
CHANGES = f.read()
4654

47-
rj_include_dir = './rapidjson/include'
48-
49-
for idx, arg in enumerate(sys.argv[:]):
50-
if arg.startswith('--rj-include-dir='):
51-
sys.argv.pop(idx)
52-
rj_include_dir = arg.split('=', 1)[1]
53-
break
54-
5555
extension_options = {
5656
'sources': ['./rapidjson.cpp'],
5757
'include_dirs': [rj_include_dir],

0 commit comments

Comments
 (0)