File tree 1 file changed +10
-15
lines changed
opentelemetry-api/src/opentelemetry/auto_instrument
1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change 16
16
17
17
from shutil import which
18
18
from os import environ , execl
19
- from os .path import dirname , pathsep
19
+ from os .path import dirname , join
20
20
from sys import argv
21
21
22
22
23
- def _add_bootstrap_to_pythonpath (bootstrap_dir ):
24
- """
25
- Add our bootstrap directory to the head of $PYTHONPATH to ensure
26
- it is loaded before program code
27
- """
28
- python_path = environ .get ('PYTHONPATH' , '' )
23
+ def run () -> None :
29
24
30
- if python_path :
31
- new_path = '%s%s%s' % (
32
- bootstrap_dir , pathsep , environ ['PYTHONPATH' ])
33
- environ ['PYTHONPATH' ] = new_path
34
- else :
35
- environ ['PYTHONPATH' ] = bootstrap_dir
25
+ bootstrap_dir = dirname (__file__ )
26
+ python_path = environ .get ("PYTHONPATH" , None )
36
27
28
+ # Add our bootstrap directory to the head of $PYTHONPATH to ensure
29
+ # it is loaded before program code
30
+ if python_path is not None :
31
+ environ ["PYTHONPATH" ] = join (bootstrap_dir , python_path )
32
+ else :
33
+ environ ["PYTHONPATH" ] = bootstrap_dir
37
34
38
- def run () -> None :
39
- _add_bootstrap_to_pythonpath (dirname (__file__ ))
40
35
python3 = which (argv [1 ])
41
36
execl (python3 , python3 , * argv [2 :]) # type: ignore
42
37
You can’t perform that action at this time.
0 commit comments