How to package a Python script

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to package a Python script

Michael Wild
Dear all

How should I go about packaging a Python executable? Separate packages
for python2 and python3? Only one of them? If so, which? If for both,
is there any advice how to achieve this? I don't think that the
python-wheel.cygclass deals with scripts in /usr/bin/ as the docs say
that scripts should be added to PKG_CONTENTS by the maintainer. How
would I go about making sure that I get a *2 and *3 version, also
possibly with a symlink from * to *2? Is there a cannonical example I
can look into? My casual trawling through my own Cygwin installation
didn't turn up anything useful...

Cheers

Michael
Reply | Threaded
Open this post in threaded view
|

Re: How to package a Python script

Yaakov Selkowitz-2
On Wed, 2018-07-25 at 16:55 +0200, Michael Wild wrote:
> How should I go about packaging a Python executable? Separate packages
> for python2 and python3? Only one of them? If so, which? If for both,
> is there any advice how to achieve this? I don't think that the
> python-wheel.cygclass deals with scripts in /usr/bin/ as the docs say
> that scripts should be added to PKG_CONTENTS by the maintainer. How
> would I go about making sure that I get a *2 and *3 version, also
> possibly with a symlink from * to *2? Is there a cannonical example I
> can look into? My casual trawling through my own Cygwin installation
> didn't turn up anything useful...

Depends on the package.  Most python-based scripts also include
modules, and sometimes those modules are generally usable and the
script is just a convenient entrypoint thereto (in which case it should
be named 'python-foo', *2 and *3 should be made via python-
wheel.cygclass, and the script packaged with *3), and sometimes they
serve only themselves (in which case it should be named 'foo' and
packaged with the appropriate choice of python{2,3}-
{distutils,wheel}.cygclass).

--
Yaakov Selkowitz
Software Engineer - Platform Enablement Group
Red Hat, Inc.


Reply | Threaded
Open this post in threaded view
|

Re: How to package a Python script

Michael Wild
Ok, thanks! That clears things up for me.

On Wed, Jul 25, 2018 at 7:59 PM Yaakov Selkowitz <[hidden email]>
wrote:

> On Wed, 2018-07-25 at 16:55 +0200, Michael Wild wrote:
> > How should I go about packaging a Python executable? Separate packages
> > for python2 and python3? Only one of them? If so, which? If for both,
> > is there any advice how to achieve this? I don't think that the
> > python-wheel.cygclass deals with scripts in /usr/bin/ as the docs say
> > that scripts should be added to PKG_CONTENTS by the maintainer. How
> > would I go about making sure that I get a *2 and *3 version, also
> > possibly with a symlink from * to *2? Is there a cannonical example I
> > can look into? My casual trawling through my own Cygwin installation
> > didn't turn up anything useful...
>
> Depends on the package.  Most python-based scripts also include
> modules, and sometimes those modules are generally usable and the
> script is just a convenient entrypoint thereto (in which case it should
> be named 'python-foo', *2 and *3 should be made via python-
> wheel.cygclass, and the script packaged with *3), and sometimes they
> serve only themselves (in which case it should be named 'foo' and
> packaged with the appropriate choice of python{2,3}-
> {distutils,wheel}.cygclass).
>
> --
> Yaakov Selkowitz
> Software Engineer - Platform Enablement Group
> Red Hat, Inc.
>
>
>