[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - pyuno/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 22 06:53:20 UTC 2020


 pyuno/source/loader/pyuno_loader.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit a64d6de611a6dc341f9b46f68a284575deb9c922
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 19 11:32:00 2020 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 22 08:52:37 2020 +0200

    tdf#121384 don't leave a bare trailing : in PYTHONPATH
    
    and don't insert any empty path entries if that situation
    was to arise
    
    Change-Id: I8d8183485f457c3e4385181fee07390c4bfef603
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96707
    Reviewed-by: Tomáš Chvátal <tchvatal at suse.com>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Tested-by: Jenkins

diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index d1cbc9156dfc..6e974bf15c74 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -146,6 +146,7 @@ static void setPythonHome ( const OUString & pythonHome )
 static void prependPythonPath( const OUString & pythonPathBootstrap )
 {
     OUStringBuffer bufPYTHONPATH( 256 );
+    bool bAppendSep = false;
     sal_Int32 nIndex = 0;
     while( true )
     {
@@ -161,15 +162,24 @@ static void prependPythonPath( const OUString & pythonPathBootstrap )
         }
         OUString systemPath;
         osl_getSystemPathFromFileURL( fileUrl.pData, &(systemPath.pData) );
-        bufPYTHONPATH.append( systemPath );
-        bufPYTHONPATH.append( static_cast<sal_Unicode>(SAL_PATHSEPARATOR) );
+        if (!systemPath.isEmpty())
+        {
+            if (bAppendSep)
+                bufPYTHONPATH.append(static_cast<sal_Unicode>(SAL_PATHSEPARATOR));
+            bufPYTHONPATH.append(systemPath);
+            bAppendSep = true;
+        }
         if( nNew == -1 )
             break;
         nIndex = nNew + 1;
     }
     const char * oldEnv = getenv( "PYTHONPATH");
     if( oldEnv )
+    {
+        if (bAppendSep)
+            bufPYTHONPATH.append( static_cast<sal_Unicode>(SAL_PATHSEPARATOR) );
         bufPYTHONPATH.append( OUString(oldEnv, strlen(oldEnv), osl_getThreadTextEncoding()) );
+    }
 
     OUString envVar("PYTHONPATH");
     OUString envValue(bufPYTHONPATH.makeStringAndClear());


More information about the Libreoffice-commits mailing list