def pybind11_tests(submodules): return Recipe([ sh("mkdir -p {output}", output="pybind11-test-build"), sh("cmake ../pybind11", cwd=Path("pybind11-test-build")), sh("make check -j 4", cwd=Path("pybind11-test-build"), interactive=True), ], synchronous=True, setup=submodules)
def link_pybind11_module(pybind11_module_objects): return sh( "{CC} -O3 -shared -Wall -std=c++2a -fPIC {input} -o {output}", env=RELEASE_ENV, input=pybind11_module_objects, output=Path("jotdown%s" % check("python3-config --extension-suffix")), )
def run_test(test): return sh( "{test}", cwd="test", env=ENV, test=test, interactive=test.output.name in INTERACTIVE_TESTS, )
def compile_test(src, headers): return sh( "{CC} {CFLAGS} {src} {LDFLAGS} -o {output}", env=ENV, src=src, output=Path(src).with_suffix(""), requires=headers, )
def compile_app(src, headers, env): return sh( "{CC} {CFLAGS} {src} {LDFLAGS} -o {output}", env=env, src=src, output=Path(src).with_suffix(""), includes=headers, )
def compile_pybind11_module_object(src, headers, tests): return sh( "{CC} -O3 -shared -Wall -std=c++2a -fPIC {flags} {src} -o {output}", env=RELEASE_ENV, src=src, tests=tests, output=Path(src).with_suffix(".o"), flags=INCLUDES + shlex.split(check("python-config --includes")), requires=headers, )
def submodules(): return sh("git submodule update --init --recursive")
def run_tests(tests): return tuple(sh("{input}", input=test, cwd="test") for test in tests)
def run_test(app): return sh("{test}", test=app, cwd="test", interactive=True)
def upload_to_pypi(latest_tarball, pypi_password): return sh("twine upload -u {PYPI_USERNAME} -p {password} {input}", PYPI_USERNAME=PYPI_USERNAME, password=pypi_password, input=latest_tarball, redacted=['password'])
def pymodule_sdist(submodules): return sh("python3 setup.py sdist", output="dist")