[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: usr/bin/ scripts for console_scripts which lead to binaries-have-file-conflict when python 2 + 3



Hi.

Olivier Berger <olivier.berger@telecom-sudparis.eu> writes:

> Hi.
>
> I'm working on rdflib whose setup.py comes with :
>     entry_points = {
>         'console_scripts': [
>             'rdfpipe = rdflib.tools.rdfpipe:main',
>             'csv2rdf = rdflib.tools.csv2rdf:main',
>             'rdf2dot = rdflib.tools.rdf2dot:main',
>             'rdfs2dot = rdflib.tools.rdfs2dot:main',
>             'rdfgraphisomorpishm = rdflib.tools.graphisomorphism:main',
>             ],
>
> So, when building with pybuild with Python2 and Python3, these are
> installed in 2 sets of scripts in each package's /usr/bin/ and only
> differ on their respective shebang.
>
> Lintian detects the conflict OK (binaries-have-file-conflict) but it
> isn't clear to me how to resolve this.
>
> Should I add a python-rdflib-tools package (depending on either versions
> of python-rdflib or python3-rdflib ?), and then avoid installing
> the Python3 version by using a
> PYBUILD_INSTALL_ARGS_python3=--install-scripts=... and some .pyremove ?)
>
> I though maybe of another option, which is to install in each package's
> /usr/share/python[3]-rdflib/tools and only add symlinks for one of the
> packages...
>
> Is there a best practice in this case ?
>

I have seen the answers you provided, thank you.

Also, I forgot to mention that the generated scripts look like the
following :

  #!/usr/bin/python
  # EASY-INSTALL-ENTRY-SCRIPT: 'rdflib==4.0.1','console_scripts','csv2rdf'
  __requires__ = 'rdflib==4.0.1'
  import sys
  from pkg_resources import load_entry_point
  
  if __name__ == '__main__':
      sys.exit(
          load_entry_point('rdflib==4.0.1', 'console_scripts', 'csv2rdf')()
      )

... which leads to problems with (recursive) dependencies mentioned in the
.egg-info that may not be satisfied in Debian :-/


And also, the original rdflib/tools/*.py modules don't have a sheebang
on first line, which prevents a direct symlink option from /usr/bin/...
  
So... after various experiments, I think I'll go this way :
- get rid of these scripts installed through eazy_install
- add a python-rdflib-tools package that contains shell scripts of the
  form :

  #!/bin/sh

  exec /usr/bin/python -m rdflib.tools.csv2rdf $*

- make this package depend on python-rdflib | python3-rdflib

Thus, I hope we have something basic which works in most cases (I hope I
haven't overlooked some details).


I wonder if this would sound reasonable to add a feature to dh-python or
pybuild so that such "conversions" of 'console_scripts' could be done
automatically...

Comments/remarks much welcome.

Best regards,
-- 
Olivier BERGER 
http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)


Reply to: