@@ -1962,7 +1962,6 @@ TPythonInterface=class(TDynamicDll)
1962
1962
DEFAULT_DATETIME_CONVERSION_MODE = dcmToTuple;
1963
1963
type
1964
1964
TEngineClient = class ;
1965
- TPathInitializationEvent = procedure ( Sender : TObject; var Path : string ) of Object ;
1966
1965
TSysPathInitEvent = procedure ( Sender : TObject; PathList : PPyObject ) of Object ;
1967
1966
TPythonFlag = (pfDebug, pfInteractive, pfNoSite, pfOptimize, pfVerbose,
1968
1967
pfFrozenFlag, pfIgnoreEnvironmentFlag, pfIsolated);
@@ -2015,7 +2014,6 @@ TPythonEngine = class(TPythonInterface)
2015
2014
FPythonHome: UnicodeString;
2016
2015
FPythonPath: WCharTString;
2017
2016
FInitThreads: Boolean;
2018
- FOnPathInitialization: TPathInitializationEvent;
2019
2017
FOnSysPathInit: TSysPathInitEvent;
2020
2018
FTraceback: TPythonTraceback;
2021
2019
FUseWindowsConsole: Boolean;
@@ -2049,7 +2047,6 @@ TPythonEngine = class(TPythonInterface)
2049
2047
function GetClients ( idx : Integer ) : TEngineClient;
2050
2048
procedure Notification (AComponent: TComponent;
2051
2049
Operation: TOperation); override;
2052
- procedure CheckRegistry ;
2053
2050
procedure SetProgramArgs (var Config: PyConfig);
2054
2051
procedure InitWinConsole ;
2055
2052
procedure SetUseWindowsConsole ( const Value : Boolean );
@@ -2168,7 +2165,6 @@ TPythonEngine = class(TPythonInterface)
2168
2165
property RedirectIO: Boolean read FRedirectIO write FRedirectIO default True;
2169
2166
property UseWindowsConsole: Boolean read FUseWindowsConsole write FUseWindowsConsole default False;
2170
2167
property OnAfterInit: TNotifyEvent read FOnAfterInit write FOnAfterInit;
2171
- property OnPathInitialization: TPathInitializationEvent read FOnPathInitialization write FOnPathInitialization;
2172
2168
property OnSysPathInit: TSysPathInitEvent read FOnSysPathInit write FOnSysPathInit;
2173
2169
end ;
2174
2170
@@ -4757,14 +4753,6 @@ procedure TPythonEngine.Initialize;
4757
4753
FInitialized := True
4758
4754
else
4759
4755
begin
4760
- // CheckRegistry;
4761
- // if Assigned(Py_SetProgramName) and (Length(FProgramName) > 0) then
4762
- // Py_SetProgramName(PWCharT(FProgramName));
4763
- // AssignPyFlags;
4764
- // if Length(FPythonHome) > 0 then
4765
- // Py_SetPythonHome(PWCharT(FPythonHome));
4766
- // Py_Initialize;
4767
-
4768
4756
// Fills Config with zeros and then sets some default values
4769
4757
if pfIsolated in FPyFlags then
4770
4758
PyConfig_InitIsolatedConfig(Config)
@@ -4872,62 +4860,6 @@ procedure TPythonEngine.Notification( AComponent: TComponent;
4872
4860
IO := nil
4873
4861
end ;
4874
4862
4875
- procedure TPythonEngine.CheckRegistry ;
4876
- { $IFDEF MSWINDOWS}
4877
- var
4878
- key : string;
4879
- Path : string;
4880
- NewPath : string;
4881
- { $IFDEF CPUX86}
4882
- LMajorVersion : integer;
4883
- LMinorVersion : integer;
4884
- { $ENDIF}
4885
- VersionSuffix: string;
4886
- { $ENDIF}
4887
- begin
4888
- { $IFDEF MSWINDOWS}
4889
- if Assigned( FOnPathInitialization ) then
4890
- try
4891
- with TRegistry.Create(KEY_ALL_ACCESS and not KEY_NOTIFY) do
4892
- try
4893
- VersionSuffix := ' ' ;
4894
- { $IFDEF CPUX86}
4895
- PythonVersionFromRegVersion(RegVersion, LMajorVersion, LMinorVersion);
4896
- if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
4897
- VersionSuffix := ' -32' ;
4898
- { $ENDIF}
4899
- key := Format(' \Software\Python\PythonCore\%s%s\PythonPath' , [RegVersion, VersionSuffix]);
4900
-
4901
- RootKey := HKEY_LOCAL_MACHINE;
4902
- if not KeyExists( key ) then
4903
- begin
4904
- // try a current user installation
4905
- RootKey := HKEY_CURRENT_USER;
4906
- if not KeyExists( key ) then Exit;
4907
- end ;
4908
- // Key found
4909
- OpenKey( key, True );
4910
- try
4911
- Path := ReadString(' ' );
4912
- NewPath := Path;
4913
- FOnPathInitialization( Self, NewPath );
4914
- if NewPath <> Path then
4915
- begin
4916
- WriteString( ' ' , NewPath );
4917
- end ;
4918
- finally
4919
- CloseKey;
4920
- end ;
4921
- finally
4922
- Free;
4923
- end ;
4924
- except
4925
- // under WinNT, with a user without admin rights, the access to the
4926
- // LocalMachine keys would raise an exception.
4927
- end ;
4928
- { $ENDIF}
4929
- end ;
4930
-
4931
4863
procedure TPythonEngine.SetProgramArgs (var Config: PyConfig);
4932
4864
var
4933
4865
I: Integer;
@@ -5045,11 +4977,7 @@ function TPythonEngine.GetSequenceItem(sequence: PPyObject;
5045
4977
5046
4978
procedure TPythonEngine.SetPythonHome (const PythonHome: UnicodeString);
5047
4979
begin
5048
- { $IFDEF POSIX}
5049
- FPythonHome := UnicodeStringToUCS4String(PythonHome);
5050
- { $ELSE}
5051
4980
FPythonHome := PythonHome;
5052
- { $ENDIF}
5053
4981
end ;
5054
4982
5055
4983
procedure TPythonEngine.SetPythonPath (const Value : UnicodeString);
@@ -5063,11 +4991,7 @@ procedure TPythonEngine.SetPythonPath(const Value: UnicodeString);
5063
4991
5064
4992
procedure TPythonEngine.SetProgramName (const ProgramName: UnicodeString);
5065
4993
begin
5066
- { $IFDEF POSIX}
5067
- FProgramName := UnicodeStringToUCS4String(ProgramName);
5068
- { $ELSE}
5069
4994
FProgramName := ProgramName;
5070
- { $ENDIF}
5071
4995
end ;
5072
4996
5073
4997
function TPythonEngine.EvalPyFunction (pyfunc, pyargs:PPyObject): Variant;
0 commit comments