weixin_39704374 2020-11-30 10:29
浏览 0

Relocatable entry point script

The Crossbar.io Python package install a crossbar command line script to actually start, stop etc Crossbar.io. See here. console_scripts and entry_points is a setuptools feature.

Now, this works, but unfortunately, setuptools will generate a script upon installation that contains a shell shebang with a absolute path to the Python executable to be used.

Because of this, a Crossbar.io installation is not relocatable. I've tested that using portable PyPy. When the path in the crossbar script is adjusted to the relocated position, it works!

It will also work

  1. with #!/usr/bin/env pypy as the first line and the respective (portable) PyPy on PATH
  2. OR by starting Crossbar.io like this pypy -m crossbar.controller.cli version

A fully relocatable installation would be very nice, as we could just tar up a binary "package" and let the user completely choose installation directory. Well, there isn't anything to install then anymore (if we use a fully self-contained build), as the directory can just be moved.

Of course 1. in above depends on /usr/bin/env, which isn't for Windows, and which might be at different locations for different Unix flavors.

Probably Linux always has it under /usr/bin/env .. not sure.

On the other hand, that tarball will be OS/arch specific anyways .. so this doesn't seem to be a big restriction.

We only need binary packages for Linux and FreeBSD (Windows, OSX, .. are out of scope for now)

该提问来源于开源项目:crossbario/crossbar

  • 写回答

5条回答 默认 最新

  • weixin_39704374 2020-11-30 10:29
    关注

    There is another annoyance: after unpacking portable PyPy and installation of Crossbar.io (from Python packages) into that PyPy, there will be lots of *.pyc files which have the path of the PyPy into which Crossbar.io has been installed embedded.

    These *.pyc files can be safely deleted. Are they used by PyPy anyways?

    When they are gone, they will be generated during the next start unless the permissions prohibit writing to the directory. In this case, no * pyc files will be regenerated.

    评论

报告相同问题?