[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

2019-10-03 Thread Haibo Huang via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL373668: [lldb] Calculate relative path for symbol links 
(authored by hhb, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D67993?vs=221612=223102#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D67993

Files:
  lldb/trunk/scripts/Python/finishSwigPythonLLDB.py


Index: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in


Index: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

2019-09-25 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

This looks fine.

There is no xcode build. If you want to test building the framework, you just 
need to set LLDB_BUILD_FRAMEWORK cmake variable. I don't know if there's any 
other var than needs setting, but we have a cache file 
(cmake/caches/Apple-lldb-Xcode.cmake), which should build things the same way 
as the apple folks are building, so you could just use that.




Comment at: lldb/scripts/Python/finishSwigPythonLLDB.py:383
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
 

I guess this is unused now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67993



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


[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

2019-09-24 Thread Haibo Huang via Phabricator via lldb-commits
hhb added a comment.

In D67993#1681901 , @mgorny wrote:

> Yep, that's a change in the right direction. Have you (at least mentally) 
> verified that it produces the correct path in all cases? I wouldn't trust the 
> inputs being entirely correct.


So far I tested the easiest case in my Ubuntu. I'll do another round of tests 
on Windows and darwin before submit. But I'm afraid I don't have the right 
environment to test xcode case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67993



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


[Lldb-commits] [PATCH] D67993: [lldb] Calculate relative path for symbol links

2019-09-24 Thread Haibo Huang via Phabricator via lldb-commits
hhb created this revision.
hhb added reviewers: labath, mgorny.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This replaces the hard coded path.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67993

Files:
  lldb/scripts/Python/finishSwigPythonLLDB.py


Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in


Index: lldb/scripts/Python/finishSwigPythonLLDB.py
===
--- lldb/scripts/Python/finishSwigPythonLLDB.py
+++ lldb/scripts/Python/finishSwigPythonLLDB.py
@@ -365,7 +365,6 @@
 # Throws:   None.
 #--
 
-
 def make_symlink(
 vDictArgs,
 vstrFrameworkPythonDir,
@@ -377,27 +376,15 @@
 bDbg = "-d" in vDictArgs
 strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
 strTarget = os.path.normcase(strTarget)
-strSrc = ""
+strPrefix = vDictArgs['--prefix']
 
 os.chdir(vstrFrameworkPythonDir)
 bMakeFileCalled = "-m" in vDictArgs
 eOSType = utilsOsType.determine_os_type()
-if not bMakeFileCalled:
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# Resolve vstrSrcFile path relatively the build directory
-if eOSType == utilsOsType.EnumOsType.Windows:
-# On a Windows platform the vstrFrameworkPythonDir looks like:
-# llvm\\build\\Lib\\site-packages\\lldb
-strBuildDir = os.path.join("..", "..", "..")
-else:
-# On a UNIX style platform the vstrFrameworkPythonDir looks like:
-# llvm/build/lib/python2.7/site-packages/lldb
-strBuildDir = os.path.join("..", "..", "..", "..")
-strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
-
-return make_symlink_native(vDictArgs, strSrc, strTarget)
 
+strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
+strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
+return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---
 # Details:  Make the symbolic that the script bridge for Python will need in
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits