Re: Installing data files with pybuild

2021-12-01 Thread Stefano Rivera
Hi Julian (2021.12.01_21:47:38_+)
> I don't understand why the files are not correctly installed by
> setup.py; it has set include_package_data=True, which includes the
> files (and file patterns) listed in MANIFEST.in, but it seems that
> this is only used for the bdist and sdist targets of setup.py, but not
> for the install target.

Correct, the package_data key needs to be set in setup.py / cfg to
install data in bdist_wheels and install:
https://setuptools.pypa.io/en/latest/userguide/datafiles.html

I would suggest forwarding a patch upstream that does that.

SR

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  +1 415 683 3272



Re: Installing data files with pybuild

2021-12-01 Thread Julian Gilbey
On Wed, Dec 01, 2021 at 01:32:38PM -0500, Louis-Philippe Véronneau wrote:
> On 2021-12-01 12 h 28, Andrey Rahmatullin wrote:
> > 
> >> Only the .py files are currently included in the build; what is the
> >> best way to include all of the data files after the build step and
> >> before the test step, and then to ensure they are included in the
> >> final package?
> > Apart from fixing setup.py? execute_after_dh_auto_install I guess.
> 
> Or you can use debian/foobar.install to install the missing files in the
> right location, and keep your d/rules file cleaner :)
> 
> ex. (man dh_install):
> 
> https://sources.debian.org/src/sublime-music/0.11.16-1/debian/sublime-music.install/

Thanks Andrey and Louis-Philippe!

Yes, that might work, though the build-time tests might still fail as
I think they expect these files to be present at test time.  Since
pybuild uses the library pre-installation to perform the build-time
tests, there might be a problem here.

I don't understand why the files are not correctly installed by
setup.py; it has set include_package_data=True, which includes the
files (and file patterns) listed in MANIFEST.in, but it seems that
this is only used for the bdist and sdist targets of setup.py, but not
for the install target.

There is another possibility, which is to use the --after-build
pybuild option or the PYBUILD_AFTER_BUILD environment variable.  There
is a discussion of this in the scikit-image package here:
https://github.com/scikit-image/scikit-image/issues/4366 which links
to the actual code in debian/rules:
https://salsa.debian.org/science-team/scikit-learn/blob/37a7b4eda8b15f514c6d0f6f801c2d67e35e36c7/debian/rules#L77-84
But I was wondering whether there is a "nicer" way to do it.

Thanks!

   Julian



Re: Installing data files with pybuild

2021-12-01 Thread Louis-Philippe Véronneau
On 2021-12-01 12 h 28, Andrey Rahmatullin wrote:
> 
>> Only the .py files are currently included in the build; what is the
>> best way to include all of the data files after the build step and
>> before the test step, and then to ensure they are included in the
>> final package?
> Apart from fixing setup.py? execute_after_dh_auto_install I guess.

Or you can use debian/foobar.install to install the missing files in the
right location, and keep your d/rules file cleaner :)

ex. (man dh_install):

https://sources.debian.org/src/sublime-music/0.11.16-1/debian/sublime-music.install/

-- 
  ⢀⣴⠾⠻⢶⣦⠀
  ⣾⠁⢠⠒⠀⣿⡁  Louis-Philippe Véronneau
  ⢿⡄⠘⠷⠚⠋   po...@debian.org / veronneau.org
  ⠈⠳⣄


OpenPGP_signature
Description: OpenPGP digital signature


Re: Installing data files with pybuild

2021-12-01 Thread Andrey Rahmatullin
On Wed, Dec 01, 2021 at 04:57:44PM +, Julian Gilbey wrote:
> Hello!
> 
> pybuild is magic.  It knows where the build directory is, despite it
> seemingly calling setup.py with no command line arguments specifying
> it!
> 
> But anyway, my actual question is this.  How do I ensure that the data
> files are also copied into the package?
Why do you need this? Does setup.py not install them?

> Only the .py files are currently included in the build; what is the
> best way to include all of the data files after the build step and
> before the test step, and then to ensure they are included in the
> final package?
Apart from fixing setup.py? execute_after_dh_auto_install I guess.

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Installing data files with pybuild

2021-12-01 Thread Julian Gilbey
Hello!

pybuild is magic.  It knows where the build directory is, despite it
seemingly calling setup.py with no command line arguments specifying
it!

But anyway, my actual question is this.  How do I ensure that the data
files are also copied into the package?  My package has a source tree
that looks roughly like this:

setup.py
setup.cfg
MANIFEST.in
...
debian/
mypkg/
  __init__.py
  module1.py
  imgs/
img1.png
img2.png
  data/
data.csv
data2.txt
  module2/
__init__.py
foo.py
module2_data.txt

Only the .py files are currently included in the build; what is the
best way to include all of the data files after the build step and
before the test step, and then to ensure they are included in the
final package?

Thanks!

   Julian