Compile examples in debug mode
This commit is contained in:
parent
a4c9fb96a3
commit
94f6248d87
|
@ -38,20 +38,21 @@ class CargoModifiedSdist(SdistCommand):
|
|||
super().make_release_tree(base_dir, files)
|
||||
|
||||
import toml
|
||||
|
||||
# Cargo.toml is now staged and ready to be modified
|
||||
cargo_loc = os.path.join(base_dir, 'Cargo.toml')
|
||||
cargo_loc = os.path.join(base_dir, "Cargo.toml")
|
||||
assert os.path.exists(cargo_loc)
|
||||
|
||||
with open(cargo_loc, 'r') as f:
|
||||
with open(cargo_loc, "r") as f:
|
||||
cargo_toml = toml.load(f)
|
||||
|
||||
rel_pyo3_path = cargo_toml['dependencies']['pyo3']['path']
|
||||
rel_pyo3_path = cargo_toml["dependencies"]["pyo3"]["path"]
|
||||
base_path = os.path.dirname(__file__)
|
||||
abs_pyo3_path = os.path.abspath(os.path.join(base_path, rel_pyo3_path))
|
||||
|
||||
cargo_toml['dependencies']['pyo3']['path'] = abs_pyo3_path
|
||||
cargo_toml["dependencies"]["pyo3"]["path"] = abs_pyo3_path
|
||||
|
||||
with open(cargo_loc, 'w') as f:
|
||||
with open(cargo_loc, "w") as f:
|
||||
toml.dump(cargo_toml, f)
|
||||
|
||||
|
||||
|
@ -69,6 +70,12 @@ def get_py_version_cfgs():
|
|||
return out_cfg
|
||||
|
||||
|
||||
def make_rust_extension(module_name):
|
||||
return RustExtension(
|
||||
module_name, "Cargo.toml", rustc_flags=get_py_version_cfgs(), debug=True
|
||||
)
|
||||
|
||||
|
||||
install_requires = []
|
||||
tests_require = install_requires + ["pytest", "pytest-benchmark"]
|
||||
|
||||
|
@ -86,29 +93,14 @@ setup(
|
|||
],
|
||||
packages=["rustapi_module"],
|
||||
rust_extensions=[
|
||||
RustExtension(
|
||||
"rustapi_module.othermod", "Cargo.toml", rustc_flags=get_py_version_cfgs()
|
||||
),
|
||||
RustExtension(
|
||||
"rustapi_module.datetime", "Cargo.toml", rustc_flags=get_py_version_cfgs()
|
||||
),
|
||||
RustExtension(
|
||||
"rustapi_module.subclassing",
|
||||
"Cargo.toml",
|
||||
rustc_flags=get_py_version_cfgs(),
|
||||
),
|
||||
RustExtension(
|
||||
"rustapi_module.test_dict",
|
||||
"Cargo.toml",
|
||||
rustc_flags=get_py_version_cfgs(),
|
||||
),
|
||||
make_rust_extension("rustapi_module.othermod"),
|
||||
make_rust_extension("rustapi_module.datetime"),
|
||||
make_rust_extension("rustapi_module.subclassing"),
|
||||
make_rust_extension("rustapi_module.test_dict"),
|
||||
],
|
||||
install_requires=install_requires,
|
||||
tests_require=tests_require,
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
cmdclass={
|
||||
'test': PyTest,
|
||||
'sdist': CargoModifiedSdist,
|
||||
},
|
||||
cmdclass={"test": PyTest, "sdist": CargoModifiedSdist},
|
||||
)
|
||||
|
|
|
@ -81,7 +81,7 @@ setup(
|
|||
"Operating System :: MacOS :: MacOS X",
|
||||
],
|
||||
packages=["word_count"],
|
||||
rust_extensions=[RustExtension("word_count.word_count", "Cargo.toml")],
|
||||
rust_extensions=[RustExtension("word_count.word_count", "Cargo.toml", debug=True)],
|
||||
install_requires=install_requires,
|
||||
tests_require=tests_require,
|
||||
setup_requires=setup_requires,
|
||||
|
|
Loading…
Reference in New Issue