@@ -205,7 +205,6 @@ var (
205
205
PythonVersion = ""
206
206
// The pythonHome variable typically comes from -ldflags
207
207
// it's needed in case the agent was built using embedded libs
208
- pythonHome2 = ""
209
208
pythonHome3 = ""
210
209
// PythonHome contains the computed value of the Python Home path once the
211
210
// intepreter is created. It might be empty in case the interpreter wasn't
@@ -303,7 +302,7 @@ func pathToBinary(name string, ignoreErrors bool) (string, error) {
303
302
return absPath , nil
304
303
}
305
304
306
- func resolvePythonExecPath (pythonVersion string , ignoreErrors bool ) (string , error ) {
305
+ func resolvePythonExecPath (ignoreErrors bool ) (string , error ) {
307
306
// Since the install location can be set by the user on Windows we use relative import
308
307
if runtime .GOOS == "windows" {
309
308
_here , err := executable .Folder ()
@@ -317,30 +316,20 @@ func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, err
317
316
}
318
317
log .Debugf ("Executable folder is %v" , _here )
319
318
320
- embeddedPythonHome2 := filepath .Join (_here , ".." , "embedded2" )
321
319
embeddedPythonHome3 := filepath .Join (_here , ".." , "embedded3" )
322
320
323
321
// We want to use the path-relative embedded2/3 directories above by default.
324
322
// They will be correct for normal installation on Windows. However, if they
325
323
// are not present for cases like running unit tests, fall back to the compile
326
324
// time values.
327
- if _ , err := os .Stat (embeddedPythonHome2 ); os .IsNotExist (err ) {
328
- log .Warnf ("Relative embedded directory not found for Python 2. Using default: %s" , pythonHome2 )
329
- } else {
330
- pythonHome2 = embeddedPythonHome2
331
- }
332
325
if _ , err := os .Stat (embeddedPythonHome3 ); os .IsNotExist (err ) {
333
326
log .Warnf ("Relative embedded directory not found for Python 3. Using default: %s" , pythonHome3 )
334
327
} else {
335
328
pythonHome3 = embeddedPythonHome3
336
329
}
337
330
}
338
331
339
- if pythonVersion == "2" {
340
- PythonHome = pythonHome2
341
- } else if pythonVersion == "3" {
342
- PythonHome = pythonHome3
343
- }
332
+ PythonHome = pythonHome3
344
333
345
334
log .Infof ("Using '%s' as Python home" , PythonHome )
346
335
@@ -361,7 +350,7 @@ func resolvePythonExecPath(pythonVersion string, ignoreErrors bool) (string, err
361
350
// don't want to use the default version (aka "python") but rather "python2" or
362
351
// "python3" based on the configuration. Also on some Python3 platforms there
363
352
// are no "python" aliases either.
364
- interpreterBasename := "python" + pythonVersion
353
+ interpreterBasename := "python3"
365
354
366
355
// If we are in a development env or just the ldflags haven't been set, the PythonHome
367
356
// variable won't be set so what we do here is to just find out where our current
@@ -393,7 +382,7 @@ func Initialize(paths ...string) error {
393
382
}
394
383
395
384
// Note: pythonBinPath is a module-level var
396
- pythonBinPath , err := resolvePythonExecPath (pythonVersion , allowPathHeuristicsFailure )
385
+ pythonBinPath , err := resolvePythonExecPath (allowPathHeuristicsFailure )
397
386
if err != nil {
398
387
return err
399
388
}
@@ -407,10 +396,7 @@ func Initialize(paths ...string) error {
407
396
csPythonExecPath := TrackedCString (pythonBinPath )
408
397
defer C ._free (unsafe .Pointer (csPythonExecPath ))
409
398
410
- if pythonVersion == "2" {
411
- log .Infof ("Initializing rtloader with Python 2 %s" , PythonHome )
412
- rtloader = C .make2 (csPythonHome , csPythonExecPath , & pyErr )
413
- } else if pythonVersion == "3" {
399
+ if pythonVersion == "3" {
414
400
log .Infof ("Initializing rtloader with Python 3 %s" , PythonHome )
415
401
rtloader = C .make3 (csPythonHome , csPythonExecPath , & pyErr )
416
402
} else {
0 commit comments