Am 30.12.20 um 11:58 schrieb Chris Green:
Could I ask you to write up a post on what you did here? I've never used
cx-freeze but it sounds like a useful thing for keeping legacy stuff
functioning. A writeup from someone who's actually used it for that
would be welcome.
Of course, here is what I wrote in my 'self help' Dokuwiki wiki about it. It
refers
specifically to the OKI software I wanted to keep using but it should be fairly
easy to apply a similar process to other software.
I asked on the Python newsgroup and the one suggestion that seemed
feasible was to
package the OKI software with all its dependencies on a system which still
has Gtk2
and Python 2 and then install the whole package on esprimo.
After a bit of looking around at Snap, Appimage and such I found cx_freeze
which is
aimed specifically at Python. The latest version doesn't support Python 2
but 5.1.1
does, so this is how I've have done it....
* Install xubuntu 18.04 on my old Revo system (has to be 64-bit), 18.04
is still in support. (has to be 64-bit simply because the final target is
64-bit)
* Install cx_freeze 5.1.1 on Revo
* Install the Oki software on Revo, check that it works, pulls in lots
of libraries and packages.
* Run 'cxfreeze /usr/libexec/okimfputl/scantool.py' (scantool.py is the
utility I want to run on systems without Python 2)
* Copy the resulting 'dist' directory to the target system, name isn't
critical
Then the fun starts. There's quite a few more libraries and packages are
required
and the scan daemon needs to be runnable. (The scan daemon was,
fortunately, just
a compiled program so ran 'as is' without issues)
Files needed in /usr/libexec/okimfputl and /usr/libexec/okimfpdrv
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
There are a lot of hard coded references to /usr/libexec/okimfputl and
/usr/libexec/okimfpdrv, it **might** be possible to change all these but
I decided it would be less painful to use a couple of symbolic links
to locations in /usr/local/libexec and put the required files in
/usr/local/libexec/okimfputl and /usr/local/libexec/okimfpdrv.
I discovered what files are needed in these directories by simply running
scantool on the target and fixing each error as it arose.
Other Python package and library files
"""""""""""""""""""""""""""""""""""""
I have installed the "dist" created by cxfreeze in
/usr/local/libexec/okicxfreeze. The executable to run is thus
/usr/local/libexec/okicxfreeze/scantool.
There are also a few .so libraries and Python packages needed, as above I
just found these by running scantool and fixing each error as it appeared.
The system library files are put in /usr/local/lib, you have to run
ldconfig
after each file is put there. The Python packages (including the dreaded
pyscand.so) have to be put in the working directory when scantool is run,
so I have put them in /usr/local/libexec/okicxfreeze where the scantool
executable is.
I hope the above is useful. As I said it refers specifically to the scantool.py
that I needed for my Oki scanner but I think the description is general enough
to
be useful.
The basic process is:-
Find (or create) a system where the software you want to run works OK.
Install cx-freeze 5.1.1 on that system and run 'cxfreeze <thing you want to
run>'
Check that the executable created by cxfreeze works on the system you
built it on
Copy the executable (and its 'dist' environment) to the target where you
want to run it
Try and run it on the target
Iteratively work through the errors it throws up when you run it, in my
case these were:-
Missing .so system library files, copy them from the build system to
somewhere
they will be found on the target. You could put them in a 'private to
the
package' directory and set LD_LIBRARY_PATH or do as I did and put them
in
a standard library location (and run ldconfig after adding each).
I've used pyinstaller in the past, and it seems to do a better job with
that. It usually copies all the sytem libraries, too, but would fail
with /usr/libexec/okimfputl & friends
Christian
--
https://mail.python.org/mailman/listinfo/python-list