elif check_sanity():
ext_args = get_python_flags(['cephfs'])
cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
+ # The processed .pyx is written to CYTHON_BUILD_DIR, away from the
+ # binding's own c_*.pxd, so add this source directory to include_path
+ # for cimports to resolve.
+ source_dir = os.path.dirname(os.path.abspath(__file__))
+ include_path = [
+ source_dir,
+ os.path.join(source_dir, "..", "rados"),
+ ]
cythonize_args = dict(include_path=include_path)
else:
sys.exit(1)
# Process the template with cython_constants
processed = Tempita.sub(template_content, **cython_constants)
- # Write processed output to current working directory
- # (which is the build directory when invoked by CMake)
- output_pyx = "cephfs_processed.pyx"
+ # Write the processed output to the build directory when invoked by
+ # CMake, which exports CYTHON_BUILD_DIR but runs setup.py from the
+ # source directory; fall back to the current working directory.
+ build_dir = os.environ.get("CYTHON_BUILD_DIR", os.getcwd())
+ output_pyx = os.path.join(build_dir, "cephfs_processed.pyx")
with open(output_pyx, 'w') as f:
f.write(processed)
**ext_args
)
],
- build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
**cythonize_args
),
classifiers=[
if 'BUILD_DOC' in os.environ or 'READTHEDOCS' in os.environ:
ext_args = dict(extra_compile_args=['-DBUILD_DOC'])
cython_constants = dict(BUILD_DOC=True)
+ cythonize_args = dict()
elif check_sanity():
ext_args = get_python_flags(['rados'])
cython_constants = dict(BUILD_DOC=False)
+ # The processed .pyx is written to CYTHON_BUILD_DIR, away from the
+ # binding's own c_*.pxd, so add this source directory to include_path
+ # for cimports to resolve.
+ include_path = [os.path.dirname(os.path.abspath(__file__))]
+ cythonize_args = dict(include_path=include_path)
else:
sys.exit(1)
# Process the template with cython_constants
processed = Tempita.sub(template_content, **cython_constants)
- # Write processed output to current working directory
- # (which is the build directory when invoked by CMake)
- output_pyx = "rados_processed.pyx"
+ # Write the processed output to the build directory when invoked by
+ # CMake, which exports CYTHON_BUILD_DIR but runs setup.py from the
+ # source directory; fall back to the current working directory.
+ build_dir = os.environ.get("CYTHON_BUILD_DIR", os.getcwd())
+ output_pyx = os.path.join(build_dir, "rados_processed.pyx")
with open(output_pyx, 'w') as f:
f.write(processed)
**ext_args
)
],
- build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
+ **cythonize_args
),
classifiers=[
'Intended Audience :: Developers',
elif check_sanity():
ext_args = get_python_flags(['rados', 'rbd'])
cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
+ # The processed .pyx is written to CYTHON_BUILD_DIR, away from the
+ # binding's own c_*.pxd, so add this source directory to include_path
+ # for cimports to resolve.
+ source_dir = os.path.dirname(os.path.abspath(__file__))
+ include_path = [
+ source_dir,
+ os.path.join(source_dir, "..", "rados"),
+ ]
cythonize_args = dict(include_path=include_path)
else:
sys.exit(1)
# Process the template with cython_constants
processed = Tempita.sub(template_content, **cython_constants)
- # Write processed output to current working directory
- # (which is the build directory when invoked by CMake)
- source = "rbd_processed.pyx"
+ # Write the processed output to the build directory when invoked by
+ # CMake, which exports CYTHON_BUILD_DIR but runs setup.py from the
+ # source directory; fall back to the current working directory.
+ build_dir = os.environ.get("CYTHON_BUILD_DIR", os.getcwd())
+ source = os.path.join(build_dir, "rbd_processed.pyx")
with open(source, 'w') as f:
f.write(processed)
**ext_args
)
],
- build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
**cythonize_args
),
classifiers=[
elif check_sanity():
ext_args = get_python_flags(['rados', 'rgw'])
cython_constants = dict(BUILD_DOC=False)
- include_path = [os.path.join(os.path.dirname(__file__), "..", "rados")]
+ # The processed .pyx is written to CYTHON_BUILD_DIR, away from the
+ # binding's own c_*.pxd, so add this source directory to include_path
+ # for cimports to resolve.
+ source_dir = os.path.dirname(os.path.abspath(__file__))
+ include_path = [
+ source_dir,
+ os.path.join(source_dir, "..", "rados"),
+ ]
cythonize_args = dict(include_path=include_path)
else:
sys.exit(1)
# Process the template with cython_constants
processed = Tempita.sub(template_content, **cython_constants)
- # Write processed output to current working directory
- # (which is the build directory when invoked by CMake)
- output_pyx = "rgw_processed.pyx"
+ # Write the processed output to the build directory when invoked by
+ # CMake, which exports CYTHON_BUILD_DIR but runs setup.py from the
+ # source directory; fall back to the current working directory.
+ build_dir = os.environ.get("CYTHON_BUILD_DIR", os.getcwd())
+ output_pyx = os.path.join(build_dir, "rgw_processed.pyx")
with open(output_pyx, 'w') as f:
f.write(processed)
**ext_args
)
],
- build_dir=os.environ.get("CYTHON_BUILD_DIR", None),
**cythonize_args
),
classifiers=[