
import os
import sys

from distutils.sysconfig import get_python_lib

src = "/usr/lib/python%s/dist-packages/apt" % ("2.7" if sys.version_info[0] == 2 else "3")
dst = os.path.join(get_python_lib(), "apt")
assert os.path.isdir(src)
os.symlink(src, dst)


import os
import sys
import subprocess

from distutils.sysconfig import get_python_lib

src = subprocess.check_output(
    "/usr/bin/python%i" % sys.version_info[0], "-c", "import apt_pkg; print(apt_pkg.__file__)"
).strip()
assert os.path.isfile(src)

dst = os.path.join(get_python_lib(), os.path.basename(src))
print("Linking %s -> %s .." % (dst, src))
os.symlink(src, dst)

Change s/apt/apt_pkg/g (follow up to previous commit)
Change s/apt/apt_pkg/g (follow up to previous commit)

  
  import os
  import sys
+ import subprocess
  
  from distutils.sysconfig import get_python_lib
  
- src = "/usr/lib/python%s/dist-packages/apt" % ("2.7" if sys.version_info[0] == 2 else "3")
- dst = os.path.join(get_python_lib(), "apt")
+ src = subprocess.check_output(
+     "/usr/bin/python%i" % sys.version_info[0], "-c", "import apt_pkg; print(apt_pkg.__file__)"
+ ).strip()
- assert os.path.isdir(src)
+ assert os.path.isfile(src)
+ 
+ dst = os.path.join(get_python_lib(), os.path.basename(src))
+ print("Linking %s -> %s .." % (dst, src))
  os.symlink(src, dst)
  
Change s/apt/apt_pkg/g (follow up to previous commit)
## Code Before:

import os
import sys

from distutils.sysconfig import get_python_lib

src = "/usr/lib/python%s/dist-packages/apt" % ("2.7" if sys.version_info[0] == 2 else "3")
dst = os.path.join(get_python_lib(), "apt")
assert os.path.isdir(src)
os.symlink(src, dst)

## Instruction:
Change s/apt/apt_pkg/g (follow up to previous commit)
## Code After:

import os
import sys
import subprocess

from distutils.sysconfig import get_python_lib

src = subprocess.check_output(
    "/usr/bin/python%i" % sys.version_info[0], "-c", "import apt_pkg; print(apt_pkg.__file__)"
).strip()
assert os.path.isfile(src)

dst = os.path.join(get_python_lib(), os.path.basename(src))
print("Linking %s -> %s .." % (dst, src))
os.symlink(src, dst)
