summaryrefslogtreecommitdiff
path: root/install-dev.py.in
blob: 214b243052fa3b4c311d324a8aab804a319595e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python

"""
This file is in the public domain.

Execute pip3 in the right environment and the right parameters to install this
package in the correct path.

This is not a common use-case for pip, and thus it needs some hand-holding.
"""

import sys
import os

prefix_path = "%s/lib/python%d.%d/site-packages" % (
    "@prefix@",
    sys.version_info.major,
    sys.version_info.minor)

current_paths = os.environ.get("PYTHONPATH", "").split(":")
current_paths.append(prefix_path)
current_paths = [x for x in current_paths if x != ""]
os.environ["PYTHONPATH"] = ":".join(current_paths)

args = ["pip3", "install", '--install-option=--prefix=%s' % "@prefix@", "-e", "."]
if "@DEBIAN_PIP3_SYSTEM@":
    args.push("@DEBIAN_PIP3_SYSTEM@")

os.execvp("pip3", args)