Skip to content

Compiling with rj-include-dir cannot work #110

Description

@kbabioch

I'm trying to compile python-rapidjson with a system-wide installation of rapidjson using the --rj-include-dir.

This fails with an error message along those lines:

RapidJSON sources not found: if you cloned the git repository,

Looking at the code, this is the location, where this is triggered:

if not os.path.isdir(os.path.join(ROOT_PATH, 'rapidjson', 'include')):
raise RuntimeError("RapidJSON sources not found: if you cloned the git repository,"
" you should initialize the rapidjson submodule as explained in"
" the README.rst; in all other cases you may want to report the"
" issue.")

Since the --rj-include-dir option is only checked for later on, this cannot work:

rj_include_dir = './rapidjson/include'
for idx, arg in enumerate(sys.argv[:]):
if arg.startswith('--rj-include-dir='):
sys.argv.pop(idx)
rj_include_dir = arg.split('=', 1)[1]
break
extension_options = {
'sources': ['./rapidjson.cpp'],
'include_dirs': [rj_include_dir],
'define_macros': [('PYTHON_RAPIDJSON_VERSION', VERSION)],
}

This needs to be re-arranged. Looking in os.path.join(ROOT_PATH, 'rapidjson', 'include') for the sources before even evaluating the --rj-include-dir cannot work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions