On Fri, Feb 15, 2019 at 06:19:10PM +0100, Miro Hrončok wrote:
On 15. 02. 19 17:57, Gabriel L. Somlo wrote:
>I'm trying to package 'migen':
>
>http://www.contrib.andrew.cmu.edu/~somlo/python-migen-rpm/python-migen.spec
>
>The sources come with a ./doc directory that uses sphinx-build to
>generate documentation, and a ./doc/conf.py file which imports
>the package being built, in order to automatically paste various
>code and doc bits from the module into the resulting documentation
>...
>make: Entering directory
'/builddir/build/BUILD/migen-afe4405becdbc76539f0195c319367187012b05e/doc'
>sphinx-build -b man -d _build/doctrees . _build/man
>Running Sphinx v1.7.5
>make: Leaving directory
'/builddir/build/BUILD/migen-afe4405becdbc76539f0195c319367187012b05e/doc'
>
>Configuration error:
>There is a programable error in your configuration file:
>
>Traceback (most recent call last):
> ...
>pkg_resources.DistributionNotFound: The 'migen' distribution was not found
and is required by the application
This is tricky. It doesn't import it (that is easily tricked with
PYTHONPATH), but uses pkg_resources to fetch data about installed
packages.
I believe the easiest way is to sed conf.py to replace
pkg_resources.require("migen")[0].version
Argh, upstream is doing the typical overengineered crap. Do they realize
that they are embedding the identifier of the _previously_ installed
version in the docs?
Also, using make to call sphinx-build is so python-2.
The following diff works for me:
diff --git python-migen.spec python-migen.spec
index 9ad29027c8..8dc929a214 100644
--- python-migen.spec
+++ python-migen.spec
@@ -35,9 +35,12 @@ A Python toolbox for building complex digital hardware.
%prep
%autosetup -n %{srcname}-%{commit0}
+sed -r -i 's/(migen_version = ).*/\1"%{version}-%{release}"/'
doc/conf.py
+
%build
%py3_build
-%make_build -C doc latexpdf man
+PYTHONPATH=. sphinx-build-3 -b latex doc/ _build/doc/
+PYTHONPATH=. sphinx-build-3 -b man doc/ _build/doc/
%install
%py3_install
Zbyszek