1

I am contributing to an open source project and I am currently migrating it from python2 to python3 and I have a list of required_packages which includes: python-mysqldb and python-dev. Because of the migration, I need those to change to python3-mysqldb and python3-dev.

However, that will break the software for users who are still using python2. I was wondering if perhaps there is a smart way for the package manager (e.g. apt) to figure out if it needs to install the python3 or python2 version of python-mysqldb and python-dev. For example, by checking the version of /usr/bin/python or by reading an env variable. That way I could leave the name of the packages untouched and still be compatible for both python2 and python3

3
  • Are you producing Python code that runs on both V2 or v3? If you code is V3 only then people will run it with V3 anyway and IMHO requiring V3 isn't that big a requirement, most Linux systems have both V2 and V3 installed.
    – xenoid
    Commented Aug 16, 2019 at 20:09
  • It runs both V2 and V3
    – M. Buil
    Commented Aug 19, 2019 at 7:00
  • Then you need two packages, one for a V2 installation and one for a V3 installation, that respectively reference V2 and V3 python packages (they can/should also reference python v2 and pythonv3). AFAIK package references are not dynamically determined on install. This said, you can have one single package that requires V3, not a problem to make that a prereq in 2019.
    – xenoid
    Commented Aug 19, 2019 at 19:39

0

You must log in to answer this question.

Browse other questions tagged .