-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the path of setup.py instead of cwd to determine where the sources are located #160
Conversation
…s are located. This makes it possible to install the library using pip+git.
Thanks for the PR. The CI failure looks legit and a lot similar to the issue you've created (#159). |
The CI failure is an interesting one. The I'm not sure what the correct solution is here. One workaound could be to expose a |
Python build was reading and parsing CMakeLists.txt from the parent dir to get the project name and version. Although this reduces one point that can fall out of sync during a release, it caused python builds to break when built/installed from pip. This commit fixes this issue by hard coding the version in python/setup.py and then extends the release tooling to also update this file. Related-to: #160 Signed-off-by: Marco Nilsson <[email protected]> Signed-off-by: Siddharth Chandrasekaran <[email protected]>
I think, I fixed one other problem than that was in this PR in 42399bb. That also implicitly merged this change (I added your |
That should work. My proposal would be something like -current_dir = os.path.dirname(os.path.realpath(__file__))
-build_dir = os.path.abspath(os.path.join(current_dir, "build"))
-root_dir = os.path.abspath(os.path.join(current_dir, ".."))
+from setuptools import Extension, setup
+
+# Allow the caller to specify the location of the source tree while using the
+# location of setup.py as fallback. This allows the CI to build wheel packages
+# using the "build" package while simultaneously opening up for pip
+# installations over git+https.
+setup_py_dir = os.path.dirname(os.path.realpath(__file__))
+source_dir = os.environ.get("SOURCE_DIR", setup_py_dir)
+build_dir = os.path.abspath(os.path.join(source_dir, "build"))
+root_dir = os.path.abspath(os.path.join(source_dir, "..")) Where the location of However, if you're happy with the hard coded version number I'm happy :) Edit: Oh, you change the version at build time. Gotcha! |
There are still references to the C sources. I'm not sure this can be resolved without pointing |
Python wheel build happens outside of source tree and hence cannot access files that are in the git tree. To workaround this issue, let's vendor all sources needed to build the library into to the package. Related-to: #160 Signed-off-by: Siddharth Chandrasekaran <[email protected]>
I was doing just that :). |
With that, I think we can close this PR. Please feel free to reopen if you have any further issues. |
That seems to have worked out great. Thanks!
|
This makes it possible to install the library using pip+git in setup.py/requirements.txt.