Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to select a specific office suite with unoconv #273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

monkeyiq
Copy link

Added a new --office-version option which allows the unoconv script to ignore versions of office which do not have a soffice --version output that matches the given regular expression. So unoconv can be used on a machine with LibreOffice 4.3 and 5.x and the user can select which version to use to run the conversion.

Sorry about the whitespace in there, I'm happy to clean that up and other things if the idea of the patch looks ok. I'm also not liking my current parseEarlyOptions duplicating the getopt.getopt() call. I'm not sure if this is the optimal way to do this. If a --list-versions option with a --use-version option might be more logical.

I am looking to use this with OfficeShots.org to allow LibreOffice 4.3.x and 5.x to both be installed and to let officeshots select which of those versions should be used for a specific conversion.

…o ignore

versions of office which do not have a soffice --version output that matches
the given regular expression. So unoconv can be used on a machine with LibreOffice
4.3 and 5.x and the user can select which version to use to run the conversion.

a regular expression. This lets the script find many
@dagwieers
Copy link
Member

Ok, I am not in favor of this because I'd prefer to get rid of the whole guessing where things are installed and favoring some places over others. If you like to force a specific LibreOffice/OpenOffice simply use the correct python-binary that ships with that version, unoconv will automatically use the correct version. This is also documented in the README and you can even hardcode that version of python in the shebang to force it by default.

Also see:
https://github.com/dagwieers/unoconv#problems-running-unoconv-from-nginxapachephp

I prefer this over the UNOPATH variable which was used before to influence unoconv. I accept patched to the documentation/manual to make this more obvious.

Does this make sense ?

@monkeyiq
Copy link
Author

Interesting, I am on Fedora 22. By default /usr/bin/unoconv uses python3 as its interpreter. And when run with --version it finds the default LibreOffice 4.4.4.3. There doesn't seem to be a python in that subtree in /usr/lib64/libreoffice.

Doing the below alternate finds the preview version 5.x just fine.

$ /opt/libreoffice5.0/program/python  /usr/bin/unoconv --version

I have a setup python script that aids detection in officeshots itself which gives me some space to play. So I think I can work with this by doing unoconv --version and then trying to sniff around for alternatives which have a python in their subtree and running unoconv again with that. Certainly helps to keep unoconv code cleaner. Sorry about this PR and thanks for your above information!

@dagwieers
Copy link
Member

Correct, usually the distribution-supplied LibreOffice is built specifically with the distribution's python version. And so it does not ship with its own python binary. It's for that use-case we look for the LibreOffice path in the known locations. But if you use the official Libreoffice RPM packages, the advise is to use the shipped python binary to use the bindings.

@dagwieers
Copy link
Member

I am keeping this pull request open so that it reminds me to update the documentation and clearly write out the two use-cases. The documentation is not very clear on this.

Thanks for your feedback !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants