Public bug reported:

Python version is Python 3.6.7 (default, Oct 22 2018, 11:32:17)
Ubuntu 18.04.01

When I call get_python_lib() function to get the Python lib path to install a 
module it returns '/usr/lib/python3/dist-packages' instead of python3.6 dir:
python3 -c "from distutils.sysconfig import *;print(get_python_lib())"


This is because the source code '/usr/lib/python3.6/distutils/sysconfig.py' has 
the branch on Ubuntu:

Code:
------------
    if os.name == "posix":
        libpython = os.path.join(prefix,
                                 "lib", "python" + get_python_version())
        if standard_lib:
            return libpython
        elif (is_default_prefix and
              'PYTHONUSERBASE' not in os.environ and
              'VIRTUAL_ENV' not in os.environ and
              'real_prefix' not in sys.__dict__ and
              sys.prefix == sys.base_prefix):
            return os.path.join(prefix, "lib", "python3", "dist-packages")
------------

However, this code does not present in the original cpython code 3.6.7:
https://github.com/python/cpython/blob/ca7d2933a388677cc3bbc621913b479452c0f25a/Lib/distutils/sysconfig.py#L109

Is it the right behavior?

Why the get_python_lib() result should depend on PYTHONUSERBASE and
VIRTUAL_ENV and points to python3 instead of python3.6

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: python3 3.6.7-1~18.04
ProcVersionSignature: Ubuntu 4.15.0-44.47-generic 4.15.18
Uname: Linux 4.15.0-44-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.3
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Feb  5 12:41:28 2019
InstallationDate: Installed on 2018-09-06 (151 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
SourcePackage: python3-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: python3-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to python3-defaults in
Ubuntu.
https://bugs.launchpad.net/bugs/1814653

Title:
   get_python_lib() returns path to python3 instead of python3.6

Status in python3-defaults package in Ubuntu:
  New

Bug description:
  Python version is Python 3.6.7 (default, Oct 22 2018, 11:32:17)
  Ubuntu 18.04.01

  When I call get_python_lib() function to get the Python lib path to install a 
module it returns '/usr/lib/python3/dist-packages' instead of python3.6 dir:
  python3 -c "from distutils.sysconfig import *;print(get_python_lib())"

  
  This is because the source code '/usr/lib/python3.6/distutils/sysconfig.py' 
has the branch on Ubuntu:

  Code:
  ------------
      if os.name == "posix":
          libpython = os.path.join(prefix,
                                   "lib", "python" + get_python_version())
          if standard_lib:
              return libpython
          elif (is_default_prefix and
                'PYTHONUSERBASE' not in os.environ and
                'VIRTUAL_ENV' not in os.environ and
                'real_prefix' not in sys.__dict__ and
                sys.prefix == sys.base_prefix):
              return os.path.join(prefix, "lib", "python3", "dist-packages")
  ------------

  However, this code does not present in the original cpython code 3.6.7:
  
https://github.com/python/cpython/blob/ca7d2933a388677cc3bbc621913b479452c0f25a/Lib/distutils/sysconfig.py#L109

  Is it the right behavior?

  Why the get_python_lib() result should depend on PYTHONUSERBASE and
  VIRTUAL_ENV and points to python3 instead of python3.6

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: python3 3.6.7-1~18.04
  ProcVersionSignature: Ubuntu 4.15.0-44.47-generic 4.15.18
  Uname: Linux 4.15.0-44-generic x86_64
  ApportVersion: 2.20.9-0ubuntu7.3
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Tue Feb  5 12:41:28 2019
  InstallationDate: Installed on 2018-09-06 (151 days ago)
  InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Release amd64 (20180426)
  SourcePackage: python3-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python3-defaults/+bug/1814653/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to