Re: How to split modules in multiple deb packages

2017-02-21 Thread Simone Rossetto
Hi Ioannes,

> why would you want to do that?
> i mean: what harm comes from shipping the rpi.py file on non-rpi systems?

Because only the rpi module requires gpiozero module to work properly,
but I cannot put a dependency on gpiozero for the whole package.

> is that file exposed to the user or is it just internally used?

Exposed to the user.

> is the system failing gracefully if it is there but not really usable,
> because you are missing hardware? (if so, there is no need to split).

Yes, it raises ImportError if the user tries to use a class that needs gpiozero.

> is the system failing gracefully if it is missing on systems that would
> normally use it? (if not, then splitting could actually be harmful).

Yes, same as above. But the user can complain that he/she installed a
package that requires gpiozero without having pyhton3-gpiozero in the
required list...


Bye
Simone



Re: How to split modules in multiple deb packages

2017-02-21 Thread Piotr Ożarowski
[Simone Rossetto, 2017-02-21]
> > ("mypackage" is module name which will be shipped in python3-mypackage
> > binary package and "rpi" or "rpi-daemon" is binary package shipping the 
> > daemon)
> > [...]
> > if it's one file only (without private modules) you can install directly
> > into /usr/bin/
> 
> The file rpi.py is a module of mypackage, not the binary of the
> daemon. The binary will be installed in its own package that requires
> python3-mypackage.

in that case I think shipping rpi.py with other modules in
python3-mypackage with all required dependencies in Recommends or even
Suggests (and Depends of the binary package with the daemon) sounds fine
-- 
Piotr Ożarowski Debian GNU/Linux Developer
www.ozarowski.pl  www.griffith.cc   www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645



Re: How to split modules in multiple deb packages

2017-02-21 Thread Simone Rossetto
Hi Piotr,

> ("mypackage" is module name which will be shipped in python3-mypackage
> binary package and "rpi" or "rpi-daemon" is binary package shipping the 
> daemon)
> [...]
> if it's one file only (without private modules) you can install directly
> into /usr/bin/

The file rpi.py is a module of mypackage, not the binary of the
daemon. The binary will be installed in its own package that requires
python3-mypackage.


Bye
Simone



Re: How to split modules in multiple deb packages

2017-02-21 Thread Debian/GNU
On 2017-02-18 09:16, Simone Rossetto wrote:
> One of the module is specific for Raspberry Pi, it adds some
> functionalities, but
> the daemon itself doesn't require a Pi hardware and can still do its job
> without that module even on a Pi. What I want to do is to split the modules
> in two deb packages, one with all the modules except rpi.py and one with only
> rpi.py (setting the appropriate dependencies, i.e. python3-gpiozero, etc).
> 
> How can I do that?

why would you want to do that?
i mean: what harm comes from shipping the rpi.py file on non-rpi systems?

is that file exposed to the user or is it just internally used?

is the system failing gracefully if it is there but not really usable,
because you are missing hardware? (if so, there is no need to split).

is the system failing gracefully if it is missing on systems that would
normally use it? (if not, then splitting could actually be harmful).

also, Debian has no notion of "packages only for the Raspberry", as
there is no architecture specific to the RPi (only).
So most likely you will end up with a package called "mypackage-rpi"
that can be installed on any old s390x cpu, creating even more confusion.

fgamsdr
IOhannes



Re: How to split modules in multiple deb packages

2017-02-21 Thread Piotr Ożarowski
[Simone Rossetto, 2017-02-18]
> Hello everybody, I'm packaging a daemon that I've developed in python3 and I
> need to split the core modules in two deb packages, but I don't now how to do
> that.
>
> One of the module is specific for Raspberry Pi, it adds some
> functionalities, but
> the daemon itself doesn't require a Pi hardware and can still do its job
> without that module even on a Pi. What I want to do is to split the modules
> in two deb packages, one with all the modules except rpi.py and one with only
> rpi.py (setting the appropriate dependencies, i.e. python3-gpiozero, etc).
> 
> How can I do that?

you can use this in debian/rules:
("mypackage" is module name which will be shipped in python3-mypackage
binary package and "rpi" or "rpi-daemon" is binary package shipping the daemon)

  export PYBUILD_NAME=mypackage
  override_dh_auto_install:
dh_auto_install
mv debian/python3-mypackage/usr/bin/rpi debian/rpi-daemon/usr/bin/

(add "/usr/bin/" to debian/rpi-daemon.dirs)

> I can exclude rpi.py module from main package and create a
> python3-mypackage.rpi.install

please don't use "python3-" prefix for packages that do not install
files in /usr/lib/python3/dist-packages/

> file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is
> the right way of doing that.

if it's one file only (without private modules) you can install directly
into /usr/bin/
-- 
Piotr Ożarowski Debian GNU/Linux Developer
www.ozarowski.pl  www.griffith.cc   www.debian.org
GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645



Re: Implicit namespace packages (was: Re: How to split modules in multiple deb packages)

2017-02-20 Thread Dominik George
> > This is not a Python package.
> >
> > (Hint: no __init__.py…)
> 
> Not required for Python3.
> 
> https://www.python.org/dev/peps/pep-0420/

Yep, you're right. But that would still have to be declared in
__init__.py to work properly, right? If not, that would be cool…

-nik

-- 
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Dominik George · Hundeshagenstr. 26 · 53225 Bonn
Mobile: +49-1520-1981389 · https://www.dominik-george.de/

Teckids e.V. · FrOSCon e.V.
Fellowship of the FSFE · Piratenpartei Deutschland
Opencaching Deutschland e.V. · Debian Maintainer

LPIC-3 Linux Enterprise Professional (Security)


signature.asc
Description: PGP signature


Re: How to split modules in multiple deb packages

2017-02-20 Thread Dominik George
Hi,

> > Well, in that case, with you being upstream, I'd separate the two
> > packages entirely.
> 
> Yes, I can do that. But, don't you think a whole package for a single
> python file is... too much?

Well, is it? You were the one asking how to split it ;)…

So, if you think the RPi and non-RPi parts should be separated, then
separate them. If you think they shouldn't, then don't. I'd only suggest
you make one decision, not two ;).

> >> I can exclude rpi.py module from main package and create a
> >> python3-mypackage.rpi.install
> >> file installing rpi.py in /usr/lib/python3/mypackage but I don't think it 
> >> is
> >> the right way of doing that.
> >
> > Why not?
> 
> Because I'll miss all the "egg"-related files. Won't I?

Well, you will, but that's correct. They only declare the Python
package, not the modules it contains. And as your rpi sub-package would
obviously depend on the main package, everything would be fine.

You'd indeed go with namespace packages instead if you decided to
separate the stuff upstream.

> And, how can I choose the right destination folder? /usr/lib/python3
> or /usr/lib/python3.4 perhaps?

By not using package.install, but copying the whole tree in
override_dh_auto_install and the nremoving the non-RPi parts from the
RPi copy of the tree. At least that's how I would do it if I had to.


But, seeing that you are in doubt of your own decision to split the
package: What about don't? Just make one package, period ;).

In case you think you have to split the code because part of it will
only run with python3-gpiozero, and python3-gpiozero is only available
on armel, armhf and arm64, then you have other options:

 1. Just make an architecture-dependent dependency on python3-gpiozero
and just let the rpi module throw an ImportError it gpiozero is
not available. No harm done, happens all the time, and would also
happen if you'd not install it in the first place ;).
 2. Find out that I am the python3-gpiozero maintainer, and kindly ask
me to provide gpiozero on all architectures. It does have a mock GPIO
implementation for testing purposes, if that's of any interest.

So I'd personally go with 1. now and remove the architecture
specification in the dependency once I got 2. finished.

Cheers,
Nik

-- 
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Dominik George · Hundeshagenstr. 26 · 53225 Bonn
Mobile: +49-1520-1981389 · https://www.dominik-george.de/

Teckids e.V. · FrOSCon e.V.
Fellowship of the FSFE · Piratenpartei Deutschland
Opencaching Deutschland e.V. · Debian Maintainer

LPIC-3 Linux Enterprise Professional (Security)


signature.asc
Description: PGP signature


Re: How to split modules in multiple deb packages

2017-02-20 Thread Simone Rossetto
Hi Dominik, thanks for your reply.

> Well, in that case, with you being upstream, I'd separate the two
> packages entirely.

Yes, I can do that. But, don't you think a whole package for a single
python file is... too much?

>> I can exclude rpi.py module from main package and create a
>> python3-mypackage.rpi.install
>> file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is
>> the right way of doing that.
>
> Why not?

Because I'll miss all the "egg"-related files. Won't I?
And, how can I choose the right destination folder? /usr/lib/python3
or /usr/lib/python3.4 perhaps?

> This is not a Python package.
>
> (Hint: no __init__.py…)

Of course there is a __init__.py file with all the required import
inside mypackage/ folder. I forgot to mention.

>> The MANIFEST.in
>>  > include setup.py
>>  > include MANIFEST.in
>>  > recursive-include mypackage *.py
>>  > include bin/mydaemon
>
> Uh? All of this is duplicating setup.py. Just remove it.

Ok, you are right.

> Instead, please
> make sure to include your full licence, readme and changelog in the
> source tarball from within MANIFEST.in.

Yes yes, the whole file include README.md, COPYING, CHANGELOG and a
samples folder.


Thanks, bye
Simone



Re: How to split modules in multiple deb packages

2017-02-20 Thread Brian May
Dominik George  writes:

> This is not a Python package.
>
> (Hint: no __init__.py…)

Not required for Python3.

https://www.python.org/dev/peps/pep-0420/
-- 
Brian May 



Re: How to split modules in multiple deb packages

2017-02-20 Thread Dominik George
Hi,

> Hello everybody, I'm packaging a daemon that I've developed in python3 and I
> need to split the core modules in two deb packages, but I don't now how to do
> that.
> 
> One of the module is specific for Raspberry Pi, it adds some
> functionalities, but
> the daemon itself doesn't require a Pi hardware and can still do its job
> without that module even on a Pi. What I want to do is to split the modules
> in two deb packages, one with all the modules except rpi.py and one with only
> rpi.py (setting the appropriate dependencies, i.e. python3-gpiozero, etc).
> 
> How can I do that?

Well, in that case, with you being upstream, I'd separate the two
packages entirely.

> I can exclude rpi.py module from main package and create a
> python3-mypackage.rpi.install
> file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is
> the right way of doing that.

Why not?

>  |-- mypackage/
>  |   |-- module1.py
>  |   |-- module2.py
>  |   |-- moduleN.py
>  |   `-- rpi.py

This is not a Python package.

(Hint: no __init__.py…)

> The MANIFEST.in
>  > include setup.py
>  > include MANIFEST.in
>  > recursive-include mypackage *.py
>  > include bin/mydaemon

Uh? All of this is duplicating setup.py. Just remove it. Instead, please
make sure to include your full licence, readme and changelog in the
source tarball from within MANIFEST.in.

-nik

-- 
PGP-Fingerprint: 3C9D 54A4 7575 C026 FB17  FD26 B79A 3C16 A0C4 F296

Dominik George · Hundeshagenstr. 26 · 53225 Bonn
Mobile: +49-1520-1981389 · https://www.dominik-george.de/

Teckids e.V. · FrOSCon e.V.
Fellowship of the FSFE · Piratenpartei Deutschland
Opencaching Deutschland e.V. · Debian Maintainer

LPIC-3 Linux Enterprise Professional (Security)


signature.asc
Description: PGP signature


How to split modules in multiple deb packages

2017-02-18 Thread Simone Rossetto
Hello everybody, I'm packaging a daemon that I've developed in python3 and I
need to split the core modules in two deb packages, but I don't now how to do
that.

One of the module is specific for Raspberry Pi, it adds some
functionalities, but
the daemon itself doesn't require a Pi hardware and can still do its job
without that module even on a Pi. What I want to do is to split the modules
in two deb packages, one with all the modules except rpi.py and one with only
rpi.py (setting the appropriate dependencies, i.e. python3-gpiozero, etc).

How can I do that?

I can exclude rpi.py module from main package and create a
python3-mypackage.rpi.install
file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is
the right way of doing that.


This is the source folder:
 mydaemon/
 |-- bin/
 |   `-- mydaemon*
 |
 |-- debian/
 |   |-- changelog
 |   |-- [...]
 |   |-- mydaemon.install
 |   |-- mydaemon.service
 |   |-- python3-mypackage-doc.install
 |   |-- rules*
 |   `-- [...]
 |
 |-- MANIFEST.in
 |-- mypackage/
 |   |-- module1.py
 |   |-- module2.py
 |   |-- moduleN.py
 |   `-- rpi.py
 |
 `-- setup.py

The setup.py file is almost this:
 > setup(name='mydaemon',
 >   packages=['mypackage'],
 >   scripts=['bin/mydaemon'],
 >   install_requires=['python-daemon','jsonschema'])

The MANIFEST.in
 > include setup.py
 > include MANIFEST.in
 > recursive-include mypackage *.py
 > include bin/mydaemon

The debian/rules file contains:
 > dh $@ --with python3,systemd --buildsystem=pybuild


Thanks, bye
Simone