Skip to content

Commit

Permalink
remove _cpp_build and _f2py_build after successfull build
Browse files Browse the repository at this point in the history
  • Loading branch information
etijskens committed Nov 8, 2019
1 parent 38b9743 commit 8e38f83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 42 deletions.
40 changes: 2 additions & 38 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,45 +1,9 @@
This section summarizes all my steps on the way to a working micc,
including dead-ends.

* started testing micc on Ubuntu (virtualbox). discovered that
`` poetry install`` fails on micc. filed bug report #1492. The issue is there
for both poetry v0.12.17 and v1.0.0b1.
As a consequence i started worrying about the fitness of poetry for this.
Poetry_ aims at "Python dependency management and packaging made easy".
Flit_ aims at "Simplified packaging of Python modules", so not at dependency
management. I am also not sure if flit is able to publish packages with binary
extension modules - it is not.
Basically, for packaging packages with binary extension modules, we still
have to rely on setuptools (see
https://buildmedia.readthedocs.org/media/pdf/python-packaging-user-guide/latest/python-packaging-user-guide.pdf).

Some interesting links:

* https://jichu4n.com/posts/how-to-add-custom-build-steps-and-commands-to-setuppy/
* https://stackoverflow.com/questions/14441955/how-to-perform-custom-build-steps-in-setup-py
* https://realitix.github.io/python/2016/11/09/python-customize-setup/
* https://coderwall.com/p/3q_czg/custom-subcommand-at-setup-py
* https://pythonhosted.org/an_example_pypi_project/setuptools.html
* https://blog.godatadriven.com/setup-py
* https://realpython.com/pypi-publish-python-package/
* https://packaging.python.org/tutorials/packaging-projects/
* https://luminousmen.com/post/resolve-cython-and-numpy-dependencies


That would mean to cut out poetry entirely until it has matured.

Alternatives:

* require that packages with binary extension must be build locally using `micc build`
* provide our own tool for producing wheels including the binary extension.

* support markdown as an alternative to reStructuredText
issue: micc is no longer compatible with itself: `micc add foo --f2py` fails.
That is of course only a problem for myself.

* make project structure compliant with Julien Danjou's recommendation in
`Serious Python <https://www.amazon.com/Serious-Python-Black-Belt-Deployment-Scalability-ebook/dp/B074S4G1L5/ref=pd_sim_351_1/140-6054425-3396237?_encoding=UTF8&pd_rd_i=B074S4G1L5&pd_rd_r=85bb9a96-660a-49c8-9fe5-ebba96467e06&pd_rd_w=zpXq6&pd_rd_wg=P0aog&pf_rd_p=5abf8658-0b5f-405c-b880-a6d1b558d4ea&pf_rd_r=65PKW9TR3QS9F2QT415E&psc=1&refRID=65PKW9TR3QS9F2QT415E>`_
Figure 1-2: i.e. put :file:`tests` under package directory
instead of under project directory.

v0.7.4 (2019-10-23)
===================
* `Github issue #3 <https://github.com/etijskens/micc/issues/3>`_
Expand Down
17 changes: 13 additions & 4 deletions micc/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,11 @@ def micc_tag(global_options):

def micc_build( module_to_build, global_options ):
"""
Build all binary extensions, i.e. f2py modules and cpp modules.
Build binary extensions, i.e. f2py modules and cpp modules.
:param str module_to_build: name of the only module to build (the prefix
``cpp_`` or ``f2py_`` may be omitted)
``cpp_`` or ``f2py_`` may be omitted). If not provided, all binrary
extensions are built.
:param types.SimpleNamespace global_options: namespace object with
options accepted by (almost) all micc commands. Relevant attributes are
Expand Down Expand Up @@ -588,6 +589,7 @@ def micc_build( module_to_build, global_options ):
build_logger.info(f"--clean: removing {d}/_f2py_build")
shutil.rmtree('_f2py_build')
returncode = build_f2py(module_name, args=f2py_args)

elif module_type=='cpp':
if build_options.load:
with open(str(module_dir / build_options.save),'r') as f:
Expand Down Expand Up @@ -629,11 +631,18 @@ def micc_build( module_to_build, global_options ):
destination.unlink()
build_logger.debug(f">>> shutil.copyfile( '{built}', '{destination}' )\n")
shutil.copyfile(built, destination)


# Remove the build directory to avoid that it will be included in the wheel
# (we cannot do this if build_options.soft_link is True
if module_type=='f2py':
build_dir = module_dir / '_f2py_build'
shutil.rmtree(build_dir)

build_logger.info(f"Built: {destination}\n"
f"Check {build_log_file} for details."
)



return 0


Expand Down

0 comments on commit 8e38f83

Please sign in to comment.