randrctl icon indicating copy to clipboard operation
randrctl copied to clipboard

pack as single executable

Open koiuo opened this issue 7 years ago • 0 comments

It is a hassle to distribute and use utility like this as a python package. Single file executable would be amazing.

Executable should be shipped with all its dependencies (likely in a virtualenv, idk if there are other options in python).

There are some options available: zipapp, pyinstaller, shiv, etc..

So far I tried playing with zipapp and following issues block further progress:

  • can't ship resources with the app. pkg_resources won't work from zipapp (can be workarounded by storing resources as strings in code)
  • can't (easily) ship dependencies that have native code in them. 2 sub-issues here: ** for example, pyyaml has dependency to libyaml. Zipapp's virtualenv will contain libyaml built for architecture of the host, where executable was built. So no "cross-building" here and sems that vm is necessary. ** zipapp documentation says, that due to some limitation native libraries can'be shipped within zipapp at all (however pyyaml worked somehow for me. Haven't investiaged yet)
  • ~~randrctl-auto script. It is a wrapper script that makes sure randrctl makes calls to xrandr under the user who owns X session (randrctl-auto is executed from udev rule and thus is always executed from root). I've seen python offers set_uid method in its api, so seems that it should be possible for randrctl to change the user.~~
  • performance. Executing zipapp on my machine takes at least twice longer, than executing randrctl normally as python script.

Any suggestions or help implementing this are hightly appreciated.

koiuo avatar Aug 31 '18 16:08 koiuo