MCPcopy Create free account
hub / github.com/numpy/numpy / _merge

Function _merge

numpy/distutils/msvc9compiler.py:7–36  ·  view source on GitHub ↗

Concatenate two environment paths avoiding repeats. Here `old` is the environment string before the base class initialize function is called and `new` is the string after the call. The new string will be a fixed string if it is not obtained from the current environment, or the same

(old, new)

Source from the content-addressed store, hash-verified

5
6
7def _merge(old, new):
8 """Concatenate two environment paths avoiding repeats.
9
10 Here `old` is the environment string before the base class initialize
11 function is called and `new` is the string after the call. The new string
12 will be a fixed string if it is not obtained from the current environment,
13 or the same as the old string if obtained from the same environment. The aim
14 here is not to append the new string if it is already contained in the old
15 string so as to limit the growth of the environment string.
16
17 Parameters
18 ----------
19 old : string
20 Previous environment string.
21 new : string
22 New environment string.
23
24 Returns
25 -------
26 ret : string
27 Updated environment string.
28
29 """
30 if not old:
31 return new
32 if new in old:
33 return old
34
35 # Neither new nor old is empty. Give old priority.
36 return ';'.join([old, new])
37
38
39class MSVCCompiler(_MSVCCompiler):

Callers 1

initializeMethod · 0.70

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected