Added: Possibility to specify extension modules.#640
Added: Possibility to specify extension modules.#640margru wants to merge 53 commits intopybuilder:masterfrom
Conversation
|
@margru thank you for you pull-request, we do appreciate it. Unfortunately, we don't have any resources at the moment to service it so please be patient. |
Adapted: Some integration tests to pass with extension modules parameter.
|
Thanks for the PR! I'm working on a major fix for the PyB with environment isolation and will look at this ASAP afterwards. |
Python sources of cythonized modules can be removed from distribution.
What doesn't make sense? Can you please be more specific? Edit: Sorry, I didn't notice that you are commenting just a specific line in the code. See my comment there... |
Pull Request Test Coverage Report for Build 11064057482Details
💛 - Coveralls |
Before this, the options provided in the requirements.txt file appear in the install_requires field which then causes errors (e.g. when using cython extensions).
Change default value when ext_modules are empty and update to upstream v0.13.5 and
|
Could you please rebase on current? |
|
@margru ? |
|
@arcivanov Yeah, I will try but I don't have that much time right now to solve the conflicts. I didn't realize that the push will also update the PR... |
Merge upstream to our patched code
Add Cython as a build dependency to setup.py
Add support for cython's compiler_directives
It contains necessary build requirements (currently only Cython if cythonization is required).
(cherry picked from commit 0cc08a8)
It contains necessary build requirements (currently only Cython if cythonization is required). (cherry picked from commit 9565af3)
# Conflicts: # src/main/python/pybuilder/plugins/python/distutils_plugin.py
Fix incorrect merge
# Conflicts: # src/main/python/pybuilder/plugins/python/unittest_plugin.py
- Maybe related only to Win platform.
| continue | ||
|
|
||
| with open(lic_file, "rt") as f: | ||
| with open(lic_file, "rt", encoding="utf8") as f: |
There was a problem hiding this comment.
That's really not necessary and works everywhere.
There was a problem hiding this comment.
If it worked everywhere, I wouldn't have to do this change ;) The original code was raising an error for me - UnicodeDecodeError regarding 'charmap' encoding...
There was a problem hiding this comment.
It doesn't do it in pristine test build environments though, including Windows on which we test. You can introduce terrible and intractable errors by forcing non-local file encoding the way you're doing it here.
Observe: https://github.com/pybuilder/pybuilder/actions/runs/9262689796/job/25480202283#step:3:1353
There was a problem hiding this comment.
OK, but do you have any idea why it's raising the UnicodeDecode error in my environment? Or what settings should I check to get rid of it? Otherwise it's useless to know that it's working in the pristine build env if I cannot build it in my env... Of course, I tried to recreate the virtualenv I am using for PyBuilder development, still the same... I am working on Win64, Python 3.10.
There was a problem hiding this comment.
There is no "Win64", except for a platform name, which doesn't say much - the CI tests also run on "Win64" and they are fine.
What version of Windows EXACTLY are you using?
Can you please run python -c 'import sys; print(sys.getdefaultencoding())' and post the output?
Can you please try using PYTHONIOENCODING=utf8 and run your pyb with this env var on and report whether it made a difference (you'd need to remove your encoding patches from your branch first though to see the effect )?
There was a problem hiding this comment.
Where did you get your Python from?
the output of the command: ascii
This isn't normal AT ALL. Windows is usually utf-16 (LE IIRC). But, more importantly, Python has been defaulting to UTF-8 since 3.6 for IO.
https://peps.python.org/pep-0528/
https://peps.python.org/pep-0529/
https://peps.python.org/pep-0540/
https://docs.python.org/3/using/windows.html#utf-8-mode
https://docs.python.org/3/library/os.html#utf8-mode
There was a problem hiding this comment.
Well, my fault, I launched the command in the default Python interpreter which is Python27 - I have multiple Python versions installed on my system. However, I have a virtualenv for building Pybuilder with Python310 and when I launch the command there, I get utf-8 even without setting the envvar. That, I think, makes the situation even more weird...
There was a problem hiding this comment.
What's your source for Python? ActivePython?
There was a problem hiding this comment.
No, all my Python versions downloaded from https://www.python.org/.
margru
left a comment
There was a problem hiding this comment.
This merge caused that building with PyBuilder is broken:
Step #2 - "build_package_3.10": Traceback (most recent call last):
Step #2 - "build_package_3.10": File "/usr/local/bin/pyb", line 5, in <module>
Step #2 - "build_package_3.10": from pybuilder.cli import main
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/cli.py", line 37, in <module>
Step #2 - "build_package_3.10": from pybuilder.reactor import Reactor
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/reactor.py", line 37, in <module>
Step #2 - "build_package_3.10": from pybuilder.pluginloader import (BuiltinPluginLoader,
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/pluginloader.py", line 33, in <module>
Step #2 - "build_package_3.10": from pybuilder.pip_common import Version
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/pip_common.py", line 20, in <module>
Step #2 - "build_package_3.10": import pkg_resources
Step #2 - "build_package_3.10": File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
Step #2 - "build_package_3.10": File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
Step #2 - "build_package_3.10": File "<frozen importlib._bootstrap>", line 672, in _load_unlocked
Step #2 - "build_package_3.10": File "<frozen importlib._bootstrap>", line 632, in _load_backward_compatible
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/extern/__init__.py", line 74, in load_module
Step #2 - "build_package_3.10": mod = import_module(extant)
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
Step #2 - "build_package_3.10": return _bootstrap._gcd_import(name[level:], package, level)
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/_vendor/pkg_resources/__init__.py", line 96, in <module>
Step #2 - "build_package_3.10": from ..jaraco.text import (
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/site-packages/pybuilder/_vendor/jaraco/text/__init__.py", line 233, in <module>
Step #2 - "build_package_3.10": files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/pathlib.py", line 1134, in read_text
Step #2 - "build_package_3.10": with self.open(mode='r', encoding=encoding, errors=errors) as f:
Step #2 - "build_package_3.10": File "/usr/local/lib/python3.10/pathlib.py", line 1119, in open
Step #2 - "build_package_3.10": return self._accessor.open(self, mode, buffering, encoding, errors,
Step #2 - "build_package_3.10": FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/site-packages/pybuilder/_vendor/jaraco/text/Lorem ipsum.txt'
Step #2 - "build_package_3.10": Incorrect pybuilder version, expecting v0.13
|
I dont think so - look at the local builds. |
|
I didn't mean building PyBuilder, but building with PyBuilder. When I build PyBuilder based on this commit, it builds OK. But when I use that PyBuilder version to build another package, I get the mentioned error (that I don't get when using the previous commit). EDIT: Just a note: I have set the PyBuilder version to |
Ah! A "couple of two" things 😄
Let me see if I can reproduce it locally with master. |
This is an improvement to fix #639. The extensions might be defined in project's
distutils_ext_modulesproperty as a list of dictionaries where each dictionary represents keyword arguments with values for a singleExtensioninstance constructor. Multiple dictionaries mean multiple extensions to build. The extensions specifications are then rendered into the setup.py script via the template.