1
|
|
|
# -*- coding: utf-8 -*- |
2
|
14 |
|
""" |
3
|
|
|
This file should hold most string literals and magic numbers used throughout the code base. |
4
|
|
|
The exception is if a literal is specifically meant to be private to and isolated within a module. |
5
|
|
|
Think of this as a "more static" source of configuration information. |
6
|
14 |
|
|
7
|
|
|
Another important source of "static" configuration is conda/models/enums.py. |
8
|
14 |
|
""" |
9
|
14 |
|
from __future__ import absolute_import, division, print_function, unicode_literals |
10
|
14 |
|
|
11
|
14 |
|
from os.path import join |
12
|
|
|
|
13
|
14 |
|
from enum import Enum |
14
|
|
|
|
15
|
14 |
|
from ..common.compat import on_win |
16
|
|
|
|
17
|
14 |
|
PREFIX_PLACEHOLDER = ('/opt/anaconda1anaconda2' |
18
|
|
|
# this is intentionally split into parts, such that running |
19
|
|
|
# this program on itself will leave it unchanged |
20
|
14 |
|
'anaconda3') |
21
|
14 |
|
|
22
|
14 |
|
machine_bits = 8 * tuple.__itemsize__ |
23
|
14 |
|
|
24
|
14 |
|
APP_NAME = 'conda' |
25
|
14 |
|
|
26
|
|
|
SEARCH_PATH = ( |
27
|
14 |
|
'/etc/conda/.condarc', |
28
|
|
|
'/etc/conda/condarc', |
29
|
|
|
'/etc/conda/condarc.d/', |
30
|
|
|
'/var/lib/conda/.condarc', |
31
|
|
|
'/var/lib/conda/condarc', |
32
|
14 |
|
'/var/lib/conda/condarc.d/', |
33
|
14 |
|
'$CONDA_ROOT/.condarc', |
34
|
14 |
|
'$CONDA_ROOT/condarc', |
35
|
14 |
|
'$CONDA_ROOT/condarc.d/', |
36
|
14 |
|
'~/.conda/.condarc', |
37
|
|
|
'~/.conda/condarc', |
38
|
14 |
|
'~/.conda/condarc.d/', |
39
|
|
|
'~/.condarc', |
40
|
14 |
|
'$CONDA_PREFIX/.condarc', |
41
|
14 |
|
'$CONDA_PREFIX/condarc', |
42
|
|
|
'$CONDA_PREFIX/condarc.d/', |
43
|
|
|
'$CONDARC', |
44
|
|
|
) |
45
|
|
|
|
46
|
10 |
|
DEFAULT_CHANNEL_ALIAS = 'https://conda.anaconda.org' |
47
|
14 |
|
CONDA_HOMEPAGE_URL = 'https://conda.io' |
48
|
|
|
ERROR_UPLOAD_URL = 'https://conda.io/conda-post/unexpected-error' |
49
|
14 |
|
DEFAULTS_CHANNEL_NAME = 'defaults' |
50
|
|
|
|
51
|
|
|
PLATFORM_DIRECTORIES = ("linux-64", |
52
|
14 |
|
"linux-32", |
53
|
14 |
|
"win-64", |
54
|
14 |
|
"win-32", |
55
|
14 |
|
"osx-64", |
56
|
|
|
"linux-ppc64le", |
57
|
14 |
|
"linux-armv6l", |
58
|
|
|
"linux-armv7l", |
59
|
|
|
"linux-aarch64", |
60
|
|
|
"zos-z", |
61
|
|
|
"noarch", |
62
|
|
|
) |
63
|
|
|
|
64
|
|
|
RECOGNIZED_URL_SCHEMES = ('http', 'https', 'ftp', 's3', 'file') |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
DEFAULT_CHANNELS_UNIX = ( |
68
|
|
|
'https://repo.anaconda.com/pkgs/main', |
69
|
|
|
'https://repo.anaconda.com/pkgs/free', |
70
|
|
|
'https://repo.anaconda.com/pkgs/r', |
71
|
|
|
) |
72
|
|
|
|
73
|
14 |
|
DEFAULT_CHANNELS_WIN = ( |
74
|
|
|
'https://repo.anaconda.com/pkgs/main', |
75
|
14 |
|
'https://repo.anaconda.com/pkgs/free', |
76
|
|
|
'https://repo.anaconda.com/pkgs/r', |
77
|
|
|
'https://repo.anaconda.com/pkgs/msys2', |
78
|
|
|
) |
79
|
14 |
|
|
80
|
|
|
DEFAULT_CUSTOM_CHANNELS = { |
81
|
|
|
'pkgs/pro': 'https://repo.anaconda.com', |
82
|
14 |
|
} |
83
|
|
|
|
84
|
|
|
DEFAULT_CHANNELS = DEFAULT_CHANNELS_WIN if on_win else DEFAULT_CHANNELS_UNIX |
85
|
|
|
|
86
|
|
|
ROOT_ENV_NAME = 'base' |
87
|
|
|
|
88
|
14 |
|
ROOT_NO_RM = ( |
89
|
|
|
'python', |
90
|
|
|
'pycosat', |
91
|
|
|
'ruamel_yaml', |
92
|
14 |
|
'conda', |
93
|
|
|
'openssl', |
94
|
14 |
|
'requests', |
95
|
14 |
|
) |
96
|
|
|
|
97
|
14 |
|
DEFAULT_AGGRESSIVE_UPDATE_PACKAGES = ( |
98
|
|
|
'ca-certificates', |
99
|
|
|
'certifi', |
100
|
|
|
'openssl', |
101
|
|
|
) |
102
|
|
|
|
103
|
|
|
if on_win: |
104
|
|
|
COMPATIBLE_SHELLS = ( |
105
|
|
|
'bash', |
106
|
|
|
'cmd.exe', |
107
|
|
|
'fish', |
108
|
|
|
'tcsh', |
109
|
|
|
'xonsh', |
110
|
|
|
'zsh', |
111
|
|
|
) |
112
|
|
|
else: |
113
|
|
|
COMPATIBLE_SHELLS = ( |
114
|
|
|
'bash', |
115
|
|
|
'fish', |
116
|
|
|
'tcsh', |
117
|
|
|
'xonsh', |
118
|
|
|
'zsh', |
119
|
|
|
) |
120
|
|
|
|
121
|
|
|
|
122
|
|
|
# Maximum priority, reserved for packages we really want to remove |
123
|
|
|
MAX_CHANNEL_PRIORITY = 10000 |
124
|
|
|
|
125
|
|
|
CONDA_TARBALL_EXTENSION = '.tar.bz2' |
126
|
|
|
|
127
|
|
|
UNKNOWN_CHANNEL = "<unknown>" |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
class SafetyChecks(Enum): |
131
|
|
|
disabled = 'disabled' |
132
|
|
|
warn = 'warn' |
133
|
|
|
enabled = 'enabled' |
134
|
|
|
|
135
|
|
|
def __str__(self): |
136
|
|
|
return self.value |
137
|
|
|
|
138
|
|
|
|
139
|
|
|
class PathConflict(Enum): |
140
|
|
|
clobber = 'clobber' |
141
|
|
|
warn = 'warn' |
142
|
|
|
prevent = 'prevent' |
143
|
|
|
|
144
|
|
|
def __str__(self): |
145
|
|
|
return self.value |
146
|
|
|
|
147
|
|
|
|
148
|
|
|
class DepsModifier(Enum): |
149
|
|
|
"""Flags to enable alternate handling of dependencies.""" |
150
|
|
|
NOT_SET = 'not_set' # default |
151
|
|
|
NO_DEPS = 'no_deps' |
152
|
|
|
ONLY_DEPS = 'only_deps' |
153
|
|
|
|
154
|
|
|
def __str__(self): |
155
|
|
|
return self.value |
156
|
|
|
|
157
|
|
|
|
158
|
|
|
class UpdateModifier(Enum): |
159
|
|
|
SPECS_SATISFIED_SKIP_SOLVE = 'specs_satisfied_skip_solve' |
160
|
|
|
FREEZE_INSTALLED = 'freeze_installed' # freeze is a better name for --no-update-deps |
161
|
|
|
UPDATE_DEPS = 'update_deps' |
162
|
|
|
UPDATE_SPECS = 'update_specs' # default |
163
|
|
|
UPDATE_ALL = 'update_all' |
164
|
|
|
|
165
|
|
|
def __str__(self): |
166
|
|
|
return self.value |
167
|
|
|
|
168
|
|
|
|
169
|
|
|
# Magic files for permissions determination |
170
|
|
|
PACKAGE_CACHE_MAGIC_FILE = 'urls.txt' |
171
|
|
|
PREFIX_MAGIC_FILE = join('conda-meta', 'history') |
172
|
|
|
|