Explorar el Código

HPCC-18718 Back-compatiibility issues with python2 plugin

Renaming the python2 plugin means people submitting code using older versions
of the clienttools get link errors.

In hindsight the plugin should probably not have been renamed. But since we
did, we can use a symlink with the old name to ease some of the pain.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman hace 7 años
padre
commit
3a56cf9118

+ 8 - 0
clienttools/install/post_install.sh

@@ -48,6 +48,7 @@ CUR_DIR=$(pwd)
 SRC_DIR=$(pwd)
 CT_HOME=$(echo $SRC_DIR | sed -n "s/^\(.*clienttools\)\(.*\)/\1/p")
 CT_BIN=${CT_HOME}/bin
+PY2_BIN=${CT_HOME}/versioned/python2
 ECL_TEST_DIR=${CT_HOME}/testing/regress
 cd $CUR_DIR
 
@@ -67,6 +68,8 @@ then
     done
     [ -e ${ECL_TEST_DIR}/ecl-test ] && \
            ln -sf ${ECL_TEST_DIR}/ecl-test  ${TARGET_DIR}/ecl-test  
+    [ -e ${PY2_BIN}/libpy2embed.so ] && \
+           ln -sf ${PY2_BIN}/libpy2embed.so ${PY2_BIN}/libpyembed.so  
     
 
 else
@@ -82,6 +85,11 @@ else
        ls -l ${TARGET_DIR}/ecl-test | egrep -q "${ECL_TEST_DIR}/ecl-test"
        [ $? -eq 0 ] && rm -rf ${TARGET_DIR}/ecl-test
     fi
+    if [ -e ${PY2_BIN}/libpyembed.so ]
+    then
+       ls -l ${PY2_BIN}/libpyembed.so | egrep -q "${PY2_BIN}/libpy2embed.so"
+       [ $? -eq 0 ] && rm -rf ${PY2_BIN}/libpyembed.so 
+    fi
 fi
 
 exit 0

+ 4 - 0
plugins/pyembed/CMakeLists.txt

@@ -90,6 +90,10 @@ if(PY2EMBED)
             roxiemem
             jlib)
     endif()
+    if ( PLATFORM )
+        install ( PROGRAMS pyembed.install DESTINATION etc/init.d/install COMPONENT Runtime )
+        install ( PROGRAMS pyembed.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )
+    endif()
 endif()
 if(PLATFORM OR CLIENTTOOLS_ONLY)
     install(

+ 16 - 0
plugins/pyembed/pyembed.cpp

@@ -1720,3 +1720,19 @@ extern DECL_EXPORT bool syntaxCheck(const char *script)
 }
 
 } // namespace
+
+// For back compatibility we also answer to the name "pyembed"...
+
+namespace pyembed {
+
+extern DECL_EXPORT IEmbedContext* getEmbedContext()
+{
+    return new py2embed::Python27EmbedContext;
+}
+
+extern DECL_EXPORT bool syntaxCheck(const char *script)
+{
+    return true; // MORE
+}
+
+} // namespace

+ 1 - 0
plugins/pyembed/pyembed.install

@@ -0,0 +1 @@
+installFile "$path/versioned/python2/libpy2embed.so" "$path/versioned/python2/libpyembed.so" 1 || exit 1

+ 1 - 0
plugins/pyembed/pyembed.uninstall

@@ -0,0 +1 @@
+removeSymlink "$path/versioned/python2/libpyembed.so"