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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
--- a/pkgs/.install.py 2016-10-22 22:34:35.739932506 +0800
+++ b/pkgs/.install.py 2016-10-22 22:35:04.296779737 +0800
@@ -44,6 +44,7 @@
# these may be changed in main()
ROOT_PREFIX = sys.prefix
+instdir = ROOT_PREFIX
PKGS_DIR = join(ROOT_PREFIX, 'pkgs')
SKIP_SCRIPTS = False
FORCE = False
@@ -1145,7 +1146,9 @@
return res
-def update_prefix(path, new_prefix, placeholder, mode):
+def update_prefix(path, new_prefix, placeholder, mode, instdir=None):
+ if not instdir is None:
+ new_prefix = instdir
if on_win:
# force all prefix replacements to forward slashes to simplify need
# to escape backslashes - replace with unix-style path separators
@@ -1269,7 +1272,7 @@
return set(fn[:-5] for fn in os.listdir(meta_dir) if fn.endswith('.json'))
-def link(prefix, dist, linktype=LINK_HARD):
+def link(prefix, dist, linktype=LINK_HARD, instdir=None):
'''
Link a package in a specified prefix. We assume that the packacge has
been extra_info in either
@@ -1309,7 +1312,7 @@
for f in sorted(has_prefix_files):
placeholder, mode = has_prefix_files[f]
try:
- update_prefix(join(prefix, f), prefix, placeholder, mode)
+ update_prefix(join(prefix, f), prefix, placeholder, mode, instdir)
except PaddingError:
sys.exit("ERROR: placeholder '%s' too short in: %s\n" %
(placeholder, dist))
@@ -1384,7 +1387,7 @@
prefix = prefix_env(env_name)
for dist in dists:
assert dist in IDISTS
- link(prefix, dist, linktype)
+ link(prefix, dist, linktype, instdir)
for dist in duplicates_to_remove(linked(prefix), dists):
meta_path = join(prefix, 'conda-meta', dist + '.json')
@@ -1419,7 +1422,7 @@
def main():
- global ROOT_PREFIX, PKGS_DIR, FORCE
+ global ROOT_PREFIX, PKGS_DIR, FORCE, instdir
p = OptionParser(description="conda link tool used by installers")
@@ -1428,6 +1431,10 @@
default=abspath(join(__file__, '..', '..')),
help="root prefix (defaults to %default)")
+ p.add_option('--instdir',
+ action="store",
+ help="install dir (defaults to root prefix)")
+
p.add_option('--post',
action="store",
help="perform post extract (on a single package), "
@@ -1439,6 +1446,10 @@ p.error('no arguments expected')
ROOT_PREFIX = opts.root_prefix
+ if not opts.instdir:
+ instdir = ROOT_PREFIX
+ else:
+ instdir = opts.instdir
PKGS_DIR = join(ROOT_PREFIX, 'pkgs')
if opts.post:
|