-
Notifications
You must be signed in to change notification settings - Fork 260
Add build script without setup.py support #45
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/masonry/builders/fixtures/extended_with_no_setup/README.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Module 1 | ||
| ======== |
27 changes: 27 additions & 0 deletions
27
tests/masonry/builders/fixtures/extended_with_no_setup/build.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import os | ||
| import shutil | ||
| from distutils.command.build_ext import build_ext | ||
| from distutils.core import Distribution, Extension | ||
|
|
||
| extensions = [Extension("extended.extended", ["extended/extended.c"])] | ||
|
|
||
|
|
||
| def build(): | ||
| distribution = Distribution({"name": "extended", "ext_modules": extensions}) | ||
| distribution.package_dir = "extended" | ||
|
|
||
| cmd = build_ext(distribution) | ||
| cmd.ensure_finalized() | ||
| cmd.run() | ||
|
|
||
| # Copy built extensions back to the project | ||
| for output in cmd.get_outputs(): | ||
| relative_extension = os.path.relpath(output, cmd.build_lib) | ||
| shutil.copyfile(output, relative_extension) | ||
| mode = os.stat(relative_extension).st_mode | ||
| mode |= (mode & 0o444) >> 2 | ||
| os.chmod(relative_extension, mode) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| build() |
Empty file.
58 changes: 58 additions & 0 deletions
58
tests/masonry/builders/fixtures/extended_with_no_setup/extended/extended.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| #include <Python.h> | ||
|
|
||
|
|
||
| static PyObject *hello(PyObject *self) { | ||
| return PyUnicode_FromString("Hello"); | ||
| } | ||
|
|
||
|
|
||
| static PyMethodDef module_methods[] = { | ||
| { | ||
| "hello", | ||
| (PyCFunction) hello, | ||
| NULL, | ||
| PyDoc_STR("Say hello.") | ||
| }, | ||
| {NULL} | ||
| }; | ||
|
|
||
| #if PY_MAJOR_VERSION >= 3 | ||
| static struct PyModuleDef moduledef = { | ||
| PyModuleDef_HEAD_INIT, | ||
| "extended", | ||
| NULL, | ||
| -1, | ||
| module_methods, | ||
| NULL, | ||
| NULL, | ||
| NULL, | ||
| NULL, | ||
| }; | ||
| #endif | ||
|
|
||
| PyMODINIT_FUNC | ||
| #if PY_MAJOR_VERSION >= 3 | ||
| PyInit_extended(void) | ||
| #else | ||
| init_extended(void) | ||
| #endif | ||
| { | ||
| PyObject *module; | ||
|
|
||
| #if PY_MAJOR_VERSION >= 3 | ||
| module = PyModule_Create(&moduledef); | ||
| #else | ||
| module = Py_InitModule3("extended", module_methods, NULL); | ||
| #endif | ||
|
|
||
| if (module == NULL) | ||
| #if PY_MAJOR_VERSION >= 3 | ||
| return NULL; | ||
| #else | ||
| return; | ||
| #endif | ||
|
|
||
| #if PY_MAJOR_VERSION >= 3 | ||
| return module; | ||
| #endif | ||
| } |
16 changes: 16 additions & 0 deletions
16
tests/masonry/builders/fixtures/extended_with_no_setup/pyproject.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [tool.poetry] | ||
| name = "extended" | ||
| version = "0.1" | ||
| description = "Some description." | ||
| authors = [ | ||
| "Sébastien Eustace <sebastien@eustace.io>" | ||
| ] | ||
| license = "MIT" | ||
|
|
||
| readme = "README.rst" | ||
|
|
||
| homepage = "https://python-poetry.org/" | ||
|
|
||
| [tool.poetry.build] | ||
| script = "build.py" | ||
| generate-setup-file = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.