Robotframework Imported jar library 'SwingLibrary' contains no keywords - jython

I am trying to include SwingLibrary to my robot framework tests. I have downloaded the whole jar with dependencies and added the environment variable JYTHONPATH with the value C:\TMP\JYTHONPATH\SwingLibrary-1.9.6.jar;. I am using :
Robot Framework 3.0.2 (Jython 2.7.0 on java1.7.0_79)
My robot test is pretty simple:
*** Settings ***
Library OperatingSystem
Library SwingLibrary
*** Variables ***
${MESSAGE} Hello, world!
*** Test Cases ***
My Test
[Documentation] Example test
Log ${MESSAGE}
My Keyword /WA
Another Test
Should Be Equal ${MESSAGE} Hello, world!
*** Keywords ***
My Keyword
[Arguments] ${path}
Directory Should Exist ${path}
I run the script using:
jython -vv -m robot -L TRACE -d out tests.robot
It then complains that
Imported library 'SwingLibrary' contains no keywords.
As I ran jython with verbose output I have the following output about SwingLibrary:
import: trying source D:\WA\Z-TMP\test\SwingLibrary
import: trying precompiled with no source D:\WA\Z-TMP\test\SwingLibrary$py.class
import: trying source C:\TMP\JYTHONPATH\SwingLibrary-1.9.6.jar\SwingLibrary
import: trying precompiled with no source C:\TMP\JYTHONPATH\SwingLibrary-1.9.6.jar\SwingLibrary$py.class
import: trying source C:\jython2.7.0\Lib\SwingLibrary
import: trying precompiled with no source C:\jython2.7.0\Lib\SwingLibrary$py.class
import: trying SwingLibrary in packagemanager for path None
import: trying SwingLibrary as java class in SysPathJavaLoader
import: 'SwingLibrary' as java class
import: 'SwingLibrary' as java package
[ WARN ] Imported library 'SwingLibrary' contains no keywords.

Related

Building C++ Pybind11 extension with setuptools and CMake generates .so directory

I am trying to use setuptools to install a C++ library with a Pybind11 interface using CMake. For using CMake with setuptools, I am using the code in the following answer: Extending setuptools extension to use CMake in setup.py?
I am able to build the library by hand with cmake.
Unfortunately however, when executing pip install . in the root directory of my project, the build fails.
While the first call to cmake (self.spawn(['cmake', str(cwd)] + cmake_args)) finishes without any error, executing the second call (self.spawn(['cmake', '--build', '.'] + build_args)) gives me the following error:
/users/thoerman/miniconda3/envs/postproc_np_products/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot open output file /users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so: Is a directory
collect2: error: ld returned 1 exit status
gmake[3]: *** [/users/thoerman/postproc_np_products/build/lib.linux-x86_64-cpython-37/postproc_ops_cpp.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[2]: *** [CMakeFiles/postproc_ops_cpp.dir/all] Error 2
gmake[1]: *** [CMakeFiles/postproc_ops_cpp.dir/rule] Error 2
gmake: *** [postproc_ops_cpp] Error 2
But when running the exact same commands on the command line inside the build_temp directory, everything works just fine.
Does anyone have a hint for me, what might be going wrong?
After further digging into the problem, I found the solution myself.
The problem was with the lines
extdir = pathlib.Path(self.get_ext_fullpath(ext.name))
extdir.mkdir(parents=True, exist_ok=True)
This created a directory for the target to be built. Building the target then failed, since there was already a directory with the same name.
I was able to solve it by replacing the second line as follows:
extdir.parent.mkdir(parents=True, exist_ok=True)

React-native on Android - cannot compile app

I followed all the instructions to setup Android but when I try to compile it complains it cannot find the modules required in DetoxTest.java
/Work/mine/detoxJestRn/android/app/src/main/java/com/detoxjestrn/DetoxTest.java:3: error: package android.support.test.filters does not exist
import android.support.test.filters.LargeTest;
^
/Work/mine/detoxJestRn/android/app/src/main/java/com/detoxjestrn/DetoxTest.java:4: error: package android.support.test.rule does not exist
import android.support.test.rule.ActivityTestRule;
^`
You need to add the DetoxTest.java file in the correct folder (androidTest).
For example:
$ find android/app/src -name '*.java'
android/app/src/androidTest/java/com/[your.package]/DetoxTest.java
android/app/src/main/java/com/onova/[your.package]/MainActivity.java
android/app/src/main/java/com/onova/[your.package]/MainApplication.java

No such file or directory -- Building an RPM with CPACK using custom spec file

I'm trying to build an RPM with CPACK using my own .spec file. In following the tutorial from here.
I'm getting an error when building the RPM:
No such file or directory
It has to do with the Source0 line in the .spec file
I've got this in my CMakeLists.txt file:
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/my_project.spec.in" "${CMAKE_CURRENT_BINARY_DIR}/my_project.spec" #ONLY IMMEDIATE)
SET(CPACK_RPM_USER_BINARY_SPECFILE "${CMAKE_CURRENT_BINARY_DIR}/my_project.spec")
SET(CPACK_PACKAGE_RELEASE 2)
INCLUDE(CPack)
This works and generates a .spec file. In my .spec.in file, it's got:
Buildroot: #CMAKE_CURRENT_BINARY_DIR#/_CPack_Packages/Linux/RPM/#CPACK_PACKAGE_FILE_NAME#
Name: #CPACK_PACKAGE_NAME#
Version: #CPACK_PACKAGE_VERSION#
Release: #CPACK_PACKAGE_RELEASE#%{dist}
Summary: Blah blah
Vendor: #CPACK_PACKAGE_VENDOR#
License: MIT
Source0: https://github.com/me/%{name}/archive/%{version}.tar.gz
BuildRequires: gcc, make, cmake
BuildRequires: doxygen, graphviz, doxygen-latex
%description
<SNIPPED>
Then I get rhe error
CPackRPM:Debug: *** error: File /home/me/projects/my_project/build/_CPack_Packages/Linux/RPM/SOURCES/1.0.0.0.tar.gz: No such file or directory
That error is due to the Source0 line I imagine.
If I do this instead, I get a little different error:
CPackRPM:Debug: *** error: File /home/me/projects/my_project/build/_CPack_Packages/Linux/RPM/SOURCES/my_project: No such file or directory
And somewhat related, this doesn't seem to generate an SRPM either. I need one of those to submit to Fedora for inclusion in package db.

cmake build and INCLUDE_PATH

I am trying to build a project through a cmake generated make, where one necessary header file is /usr/local/include/poppler/poppler-config.h. However
export INCLUDE_PATH=/usr/local/include/poppler/
nor
export INCLUDE_PATH=/usr/local/include/ help, and I still get:
fatal error: poppler-config.h: No such file or directory.
What could I be missing?
I already have a pkg-config file for this dependency, which looks okay:
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: poppler
Description: PDF rendering library
Version: 0.33.0
Libs: -L${libdir} -lpoppler
Cflags: -I${includedir}/poppler
But adding it to a PKG_CONFIG_PATH environment variable doesn't help either.
Is there some cmake cache to reset for this? what should be an elegant solution?

Running Cmake built executables with shared library dependencies

I have a Cmake executable that has been created using ADD_EXECUTABLE.
The executable needs (links to) shared libraries that have been created
also part of the project.
As a final step I want to run this executable as part of the build process to
create some additional files for the build.
so
ADD_EXECUTABLE(foo)
ADD_CUSTOM_COMMAND(OUTPUT out1
WORKING_DIRECTORY dir1
COMMAND foo args
...)
However when the custom command runs it gives an error
.../foo: error while loading shared libraries: libbar.so.1: cannot open shared object file: No such file or directory
make[2]: *** [out1] Error 127
make: *** [all] Error 2
The problem is that the LD_LIBRARY_PATH is not set for the executable to load the library
libbar.so.1. How do in a cross-platform manner set the load library settings in cmake.
I don't want to use RPATH because it actually embeds those paths in the executable, which I
don't want.