57
57
# User facing text:
58
58
strMsgOsVersion = "The current OS is %s" ;
59
59
strMsgPyVersion = "The Python version is %d.%d" ;
60
- strErrMsgProgFail = "Program failure: " ;
60
+ strErrMsgProgFail = "Program failure: " ;
61
+ strErrMsgLLDBPyFileNotNotFound = "Unable to locate lldb.py at path '%s'" ;
62
+ strMsgCopyLLDBPy = "Copying lldb.py from '%s' to '%s'" ;
61
63
strErrMsgFrameWkPyDirNotExist = "Unable to find the LLDB.framework directory '%s'" ;
64
+ strMsgCreatePyPkgCopyPkgFile = "create_py_pkg: Copied file '%s' to folder '%s'" ;
65
+ strMsgCreatePyPkgInitFile = "create_py_pkg: Creating pakage init file '%s'" ;
66
+ strMsgCreatePyPkgMkDir = "create_py_pkg: Created folder '%s'" ;
67
+ strMsgConfigBuildDir = "Configuration build directory located at '%s'" ;
62
68
strMsgFoundLldbFrameWkDir = "Found '%s'" ;
63
69
strMsgPyFileLocatedHere = "Python file will be put in '%s'" ;
64
- strMsgFrameWkPyExists = "'%s' already exists" ;
65
- strMsgFrameWkPyMkDir = "Making directory '%s'" ;
70
+ strMsgFrameWkPyExists = "Python output folder '%s' already exists" ;
71
+ strMsgFrameWkPyMkDir = "Python output folder '%s' will be created " ;
66
72
strErrMsgCreateFrmWkPyDirFailed = "Unable to create directory '%s' error: %s" ;
67
- strMsglldbsoExists = "'%s' already exists" ;
73
+ strMsglldbsoExists = "Symlink '%s' already exists" ;
68
74
strMsglldbsoMk = "Creating symlink for _lldb.so" ;
69
75
strErrMsgCpLldbpy = "copying lldb to lldb package directory" ;
70
76
strErrMsgCreatePyPkgMissingSlash = "Parameter 3 fn create_py_pkg() missing slash" ;
@@ -117,7 +123,8 @@ def macosx_copy_file_for_heap( vDictArgs, vstrFrameworkPythonDir ):
117
123
def create_py_pkg ( vDictArgs , vstrFrameworkPythonDir , vstrPkgDir , vListPkgFiles ):
118
124
dbg = utilsDebug .CDebugFnVerbose ( "Python script create_py_pkg()" );
119
125
dbg .dump_object ( "Package file(s):" , vListPkgFiles );
120
-
126
+ bDbg = vDictArgs .has_key ( "-d" );
127
+
121
128
bOk = True ;
122
129
strMsg = "" ;
123
130
@@ -135,11 +142,15 @@ def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles
135
142
strPkgDir = os .path .normcase ( strPkgDir );
136
143
137
144
if not (os .path .exists ( strPkgDir ) and os .path .isdir ( strPkgDir )):
145
+ if bDbg :
146
+ print (strMsgCreatePyPkgMkDir % strPkgDir );
138
147
os .makedirs ( strPkgDir );
139
148
140
149
for strPkgFile in vListPkgFiles :
141
150
if os .path .exists ( strPkgFile ) and os .path .isfile ( strPkgFile ):
142
151
strPyFile = os .path .normcase ( strPkgFile );
152
+ if bDbg :
153
+ print (strMsgCreatePyPkgCopyPkgFile % (strPkgFile , strPkgDir ));
143
154
shutil .copy ( strPyFile , strPkgDir );
144
155
145
156
# Create a packet init files if there wasn't one
@@ -163,6 +174,8 @@ def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles
163
174
strPyScript += "for x in __all__:\n " ;
164
175
strPyScript += "\t __import__('%s.' + x)" % strPkgName ;
165
176
177
+ if bDbg :
178
+ print (strMsgCreatePyPkgInitFile % strPkgIniFile );
166
179
file = open ( strPkgIniFile , "w" );
167
180
file .write ( strPyScript );
168
181
file .close ();
@@ -172,15 +185,17 @@ def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles
172
185
#++---------------------------------------------------------------------------
173
186
# Details: Copy the lldb.py file into the lldb package directory and rename
174
187
# to __init_.py.
175
- # Args: vstrFrameworkPythonDir - (R) Python framework directory.
188
+ # Args: vDictArgs - (R) Program input parameters.
189
+ # vstrFrameworkPythonDir - (R) Python framework directory.
176
190
# vstrCfgBldDir - (R) Config directory path.
177
191
# Returns: Bool - True = function success, False = failure.
178
192
# Str - Error description on task failure.
179
193
# Throws: None.
180
194
#--
181
- def copy_lldbpy_file_to_lldb_pkg_dir ( vstrFrameworkPythonDir , vstrCfgBldDir ):
195
+ def copy_lldbpy_file_to_lldb_pkg_dir ( vDictArgs , vstrFrameworkPythonDir , vstrCfgBldDir ):
182
196
dbg = utilsDebug .CDebugFnVerbose ( "Python script copy_lldbpy_file_to_lldb_pkg_dir()" );
183
197
bOk = True ;
198
+ bDbg = vDictArgs .has_key ( "-d" );
184
199
strMsg = "" ;
185
200
186
201
strSrc = vstrCfgBldDir + "/lldb.py" ;
@@ -189,9 +204,12 @@ def copy_lldbpy_file_to_lldb_pkg_dir( vstrFrameworkPythonDir, vstrCfgBldDir ):
189
204
strDst = os .path .normcase ( strDst );
190
205
191
206
if not os .path .exists ( strSrc ):
207
+ strMsg = strErrMsgLLDBPyFileNotNotFound % strSrc ;
192
208
return (bOk , strMsg );
193
209
194
210
try :
211
+ if bDbg :
212
+ print (strMsgCopyLLDBPy % (strSrc , strDst ));
195
213
shutil .copyfile ( strSrc , strDst );
196
214
except IOError as e :
197
215
bOk = False ;
@@ -538,15 +556,16 @@ def main( vDictArgs ):
538
556
eOSType = utilsOsType .determine_os_type ();
539
557
if bDbg :
540
558
pyVersion = sys .version_info ;
541
- print strMsgOsVersion % utilsOsType .EnumOsType .name_of ( eOSType );
542
- print strMsgPyVersion % (pyVersion [ 0 ], pyVersion [ 1 ]);
559
+ print ( strMsgOsVersion % utilsOsType .EnumOsType .name_of ( eOSType ) );
560
+ print ( strMsgPyVersion % (pyVersion [ 0 ], pyVersion [ 1 ]) );
543
561
544
562
bOk , strFrameworkPythonDir , strMsg = get_framework_python_dir ( vDictArgs );
545
563
546
564
if bOk :
547
565
bOk , strCfgBldDir , strMsg = get_config_build_dir ( vDictArgs , strFrameworkPythonDir );
548
566
if bOk and bDbg :
549
567
print strMsgPyFileLocatedHere % strFrameworkPythonDir ;
568
+ print strMsgConfigBuildDir % strCfgBldDir ;
550
569
551
570
if bOk :
552
571
bOk , strMsg = find_or_create_python_dir ( vDictArgs , strFrameworkPythonDir );
@@ -555,7 +574,8 @@ def main( vDictArgs ):
555
574
bOk , strMsg = make_symlink ( vDictArgs , strFrameworkPythonDir );
556
575
557
576
if bOk :
558
- bOk , strMsg = copy_lldbpy_file_to_lldb_pkg_dir ( strFrameworkPythonDir ,
577
+ bOk , strMsg = copy_lldbpy_file_to_lldb_pkg_dir ( vDictArgs ,
578
+ strFrameworkPythonDir ,
559
579
strCfgBldDir );
560
580
strRoot = vDictArgs [ "--srcRoot" ];
561
581
if bOk :
0 commit comments