Commit 845a2b34 authored by Carlos Ramos Carreño's avatar Carlos Ramos Carreño

Allow editable wheels.

When building an editable wheel it is not necessary that
`build_packages` (or even `run`) is called before calling `get_outputs`
(notice the following in
https://setuptools.pypa.io/en/latest/userguide/extension.html#supporting-sdists-and-editable-installs-in-build-sub-commands :
"Please note that custom sub-commands SHOULD NOT rely on `run()` being
executed (or not) to provide correct return values for `get_outputs()`,
`get_output_mapping()` or `get_source_files()`. The `get_*` methods
should work independently of `run().").

Our implementation relied in the call to `build_packages` to set the
name of the synthetic init file.
This commit uses a property of the object instead, to compute that name
whenever it is necessary.
With this change, it is now possible to make editable wheels.
parent 17deca45
......@@ -120,10 +120,13 @@ class build_py(_build_py):
return modules
@property
def initfile(self):
return self.get_module_outfile(self.build_lib, ('wendelin',), '__init__')
def build_packages(self):
_build_py.build_packages(self)
# emit std namespacing mantra to wendelin/__init__.py
self.initfile = self.get_module_outfile(self.build_lib, ('wendelin',), '__init__')
with open(self.initfile, 'w') as f:
f.write("# this is a namespace package (autogenerated)\n")
f.write("__import__('pkg_resources').declare_namespace(__name__)\n")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment