[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-15 Thread Haibo Huang via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG208e9c01fc09: [lldb] Creates _liblldb symlink from cmake 
(authored by hhb).

Changed prior to commit:
  https://reviews.llvm.org/D68858?vs=224955=225123#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-15 Thread Haibo Huang via Phabricator via lldb-commits
hhb marked an inline comment as done.
hhb added a comment.

In D68858#1709458 , @tatyana-krasnukha 
wrote:

> Build and installation completed successfully! LGTM, though it would be good 
> if anyone tests this with Xcode.


I just tested Xcode. For xcode LLDB_BUILD_FRAMEWORK is on by default so that's 
what I did. Both release and debug build looks good. Obviously xcode did 
something different than VS...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-15 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha accepted this revision.
tatyana-krasnukha added a comment.
This revision is now accepted and ready to land.

Build and installation completed successfully! LGTM, though it would be good if 
anyone tests this with Xcode.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-14 Thread Haibo Huang via Phabricator via lldb-commits
hhb marked 3 inline comments as done.
hhb added inline comments.



Comment at: lldb/CMakeLists.txt:244
+  else()
+set(LIBLLDB_SYMLINK_DEST 
"${liblldb_build_dir}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  endif()

tatyana-krasnukha wrote:
> This command still produces a path without configuration name, Visual Studio 
> failed to execute the post-build step.
> 
Thanks for testing and the patch! I found that CMAKE_CFG_INTDIR can actually be 
passed into function and expanded to $(Configure). At least in VS2019 
community... Can you try this new version? Thanks again!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-14 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224955.
hhb added a comment.

Oops fix typo.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs   

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-14 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224954.
hhb added a comment.

Fix the build for multi-config generator.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args:   

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-14 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

F10259577: D68858d.diff 

@hhb, please, take a look. Slightly changed your patch to make it work for 
Visual Studio.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-12 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added inline comments.



Comment at: lldb/CMakeLists.txt:228
+function(create_relative_symlink target dest_file output_dir output_name)
+  get_filename_component(dest_file ${dest_file} ABSOLUTE)
+  get_filename_component(output_dir ${output_dir} ABSOLUTE)

The problem is that for multi-configuration generators the current 
configuration cannot be evaluated at the configuring step i.e. you cannot just 
insert ${CMAKE_CFG_INTDIR} in the `dest_file` path and use it here. The 
variable should be expanded in the post-build command.



Comment at: lldb/CMakeLists.txt:244
+  else()
+set(LIBLLDB_SYMLINK_DEST 
"${liblldb_build_dir}/liblldb${CMAKE_SHARED_LIBRARY_SUFFIX}")
+  endif()

This command still produces a path without configuration name, Visual Studio 
failed to execute the post-build step.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-11 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224707.
hhb added a comment.

Adds VERBATIM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs   - 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-11 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224648.
hhb added a comment.

Fix file copy path


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-11 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224649.
hhb added a comment.

Fix typo


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs   - (R) 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-11 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224647.
hhb added a comment.

Fix file copy path


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-10 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224546.
hhb added a comment.

Remove tailing whitespace


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-10 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
hhb added a project: LLDB.
hhb updated this revision to Diff 224544.
hhb added a comment.
hhb updated this revision to Diff 224545.

Fix format


hhb added a comment.

Rebase


This is another attempt of D67993 .

This change removed hard coded relative paths. This way we can generate correct 
result when get_python_lib() returns a different path, or 
LLDB_PYTHON_RELATIVE_PATH is specified directly.

By moving things out of python, we are also able to correctly process more 
cross compile situations. E.g. .pyd vs .so for Windows.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-10 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224545.
hhb added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs   - (R) 

[Lldb-commits] [PATCH] D68858: [lldb] Creates _liblldb symlink from cmake

2019-10-10 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 224544.
hhb added a comment.

Fix format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68858/new/

https://reviews.llvm.org/D68858

Files:
  lldb/CMakeLists.txt
  lldb/scripts/Python/finishSwigPythonLLDB.py

Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -245,284 +245,6 @@
 
 return (bOk, strMsg)
 
-#++---
-# Details:  Make the symbolic link on a Windows platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_windows(vstrSrcPath, vstrTargetPath):
-print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)))
-dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_windows()")
-bOk = True
-strErrMsg = ""
-# If the src file doesn't exist, this is an error and we should throw.
-src_stat = os.stat(vstrSrcPath)
-
-try:
-target_stat = os.stat(vstrTargetPath)
-# If the target file exists but refers to a different file, delete it so that we can
-# re-create the link.  This can happen if you run this script once (creating a link)
-# and then delete the source file (so that a brand new file gets created the next time
-# you compile and link), and then re-run this script, so that both the target hardlink
-# and the source file exist, but the target refers to an old copy of
-# the source.
-if (target_stat.st_ino == src_stat.st_ino) and (
-target_stat.st_dev == src_stat.st_dev):
-return (bOk, strErrMsg)
-
-os.remove(vstrTargetPath)
-except:
-# If the target file don't exist, ignore this exception, we will link
-# it shortly.
-pass
-
-try:
-csl = ctypes.windll.kernel32.CreateHardLinkW
-csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
-csl.restype = ctypes.c_ubyte
-if csl(vstrTargetPath, vstrSrcPath, 0) == 0:
-raise ctypes.WinError()
-except Exception as e:
-if e.errno != 17:
-bOk = False
-strErrMsg = "WinError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (
-vstrSrcPath, vstrTargetPath)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link on a UNIX style platform.
-# Args: vstrSrcFile - (R) Source file name.
-#   vstrTargetFile  - (R) Destination file name.
-# Returns:  Bool - True = function success, False = failure.
-#   Str - Error description on task failure.
-# Throws:   None.
-#--
-
-
-def make_symlink_other_platforms(vstrSrcPath, vstrTargetPath):
-dbg = utilsDebug.CDebugFnVerbose(
-"Python script make_symlink_other_platforms()")
-bOk = True
-strErrMsg = ""
-
-try:
-os.symlink(vstrSrcPath, vstrTargetPath)
-except OSError as e:
-bOk = False
-strErrMsg = "OSError(%d): %s %s" % (
-e.errno, e.strerror, strErrMsgMakeSymlink)
-strErrMsg += " Src:'%s' Target:'%s'" % (vstrSrcPath, vstrTargetPath)
-except:
-bOk = False
-strErrMsg = strErrMsgUnexpected % sys.exec_info()[0]
-
-return (bOk, strErrMsg)
-
-
-def make_symlink_native(vDictArgs, strSrc, strTarget):
-eOSType = utilsOsType.determine_os_type()
-bDbg = "-d" in vDictArgs
-bOk = True
-strErrMsg = ""
-
-target_filename = os.path.basename(strTarget)
-if eOSType == utilsOsType.EnumOsType.Unknown:
-bOk = False
-strErrMsg = strErrMsgOsTypeUnknown
-elif eOSType == utilsOsType.EnumOsType.Windows:
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_windows(strSrc,
-  strTarget)
-else:
-if os.path.islink(strTarget):
-if bDbg:
-print((strMsgSymlinkExists % target_filename))
-return (bOk, strErrMsg)
-if bDbg:
-print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
-bOk, strErrMsg = make_symlink_other_platforms(strSrc,
-  strTarget)
-
-return (bOk, strErrMsg)
-
-#++---
-# Details:  Make the symbolic link.
-# Args: vDictArgs   -