[jhbuild] make: use symbolic link name if inside one



commit 7d74525b074d9664f0a04eb5c7e278ccb4d1f6ce
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Thu Nov 10 10:33:35 2016 +0530

    make: use symbolic link name if inside one
    
    os.getcwd() returns the absolute path. Using that causes the 'make'
    command fail when the module directory is inside a symlink directory.
    
    This patch gets the path from 'PWD' env variable value which won't
    translate the symbolic path to absolute path. Also fallback to
    os.getcwd() in case 'PWD' isn't present.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771147

 jhbuild/commands/__init__.py |    8 ++++++++
 jhbuild/commands/make.py     |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/commands/__init__.py b/jhbuild/commands/__init__.py
index 60621f7..a42f5b2 100644
--- a/jhbuild/commands/__init__.py
+++ b/jhbuild/commands/__init__.py
@@ -26,6 +26,7 @@ __all__ = [
 
 import optparse
 import sys
+import os
 
 from jhbuild.errors import UsageError, FatalError
 
@@ -58,6 +59,13 @@ class Command:
         self.parser.add_options(self.options)
         return self.parser.parse_args(args)
 
+    def get_cwd(self):
+        # Get symbolic link path when inside one
+        cwd = os.getenv('PWD')
+        if not cwd:
+            cwd = os.getcwd()
+        return cwd
+
     def run(self, config, options, args, help=None):
         """The body of the command"""
         raise NotImplementedError
diff --git a/jhbuild/commands/make.py b/jhbuild/commands/make.py
index 2c67242..1d72637 100644
--- a/jhbuild/commands/make.py
+++ b/jhbuild/commands/make.py
@@ -53,7 +53,7 @@ class cmd_make(Command):
 
     def run(self, config, options, args, help=None):
         # Grab the cwd before anything changes it
-        cwd = os.getcwd()
+        cwd = self.get_cwd()
 
         # Explicitly don't touch the network for this
         options.nonetwork = True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]