Skip to main content

Poor man's package manager (like brew link without the brew)

Project description

pkgsym — A poor man's package manager (like brew link but without the brew)

Usage and Motivation

pkgsym is a utility to symlink and un-symlink a package under from a self-contained directory to a prefix.

Say you're installing a package from source without your package manager. You perform the Unix magic invocation (or some on Windows):

./configure --prefix=/usr/local
make
sudo make install

Now you have a bunch of stuff under /usr/local. How do you determine what files came from what package? How do you uninstall the package? (Not all build systems provide a make uninstall.)

Enter pkgsym. Now you can install the package to a self-contained directory, something like this:

./configure --prefix=/usr/local/opt/foopkg
make
sudo make install

So now foo's command is something like /usr/local/opt/foo/bin/foocmd, which definitely isn't going to be in your PATH by default, and you probably don't want to add every odd directory of /usr/local/opt/*/bin to your PATH either.

Homebrew takes the approach of symlinking packages into a prefix. That's exactly what pkgsym does. Now you can finish off your package installation:

sudo pkgsym link --system foo

That will take any directories under /usr/local/opt/foo/ and symlink their contents to /usr/local/{dir}/{file}, creating any directories as necessary. So /usr/local/opt/foo/bin/cmd is symlinked to /usr/local/bin/foocmd, /usr/local/opt/foo/lib/libfoo.so is symlinked to /usr/local/lib/libfoo.so, etc. Subdirectories are handled recursively.

Now to uninstall the package, simply run:

sudo pkgsym unlink --system foo
sudo rm -rf /usr/local/opt/foo

Hey, what's that --system?

pkgsym supports any arbitrary package prefix. You could install foo to C:\Packages\opt\foo if you want, and then have foocmd as C:\Packages\bin\foocmd with something like:

cmake -B build -DCMAKE_INSTALL_PREFIX=C:/Packages/opt/foo
cmake --build build
cmake --install build
pkgsym --prefix C:/Packages link foo

(Forward slashes and backslashes are both supported for Windows).

--system is a shortcut for --prefix /usr/local, and --user is a shortcut for --prefix ~/.local. --user is the default, but is still available as an explicit argument for clarity.

What made this necessary? Are you okay?

Listen installing packages from source on Windows sucks okay? This script is basically a glorified for i in $prefix/opt/**/*; do ln -s "${i:bash/string/manipulation}", but with it as my hammer I've been able to manage dependency hell on Windows with ad-hoc packages.

If you have a real package manager available to you for the thing you want, definitely use that instead. pkgsym is for the unfortunate cases where you do not.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pkgsym-0.2.4.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

pkgsym-0.2.4-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pkgsym-0.2.4.tar.gz.

File metadata

  • Download URL: pkgsym-0.2.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pkgsym-0.2.4.tar.gz
Algorithm Hash digest
SHA256 ca4063cb38fe3e7effd64bff6f1197a11613b7ae3ea8a980a83caa7f0306fcfe
MD5 ee611a16f006562496eff02418e40682
BLAKE2b-256 907e634f211616ff8e2abff2abf6f76bf5847532143635a6524124b1762c310b

See more details on using hashes here.

File details

Details for the file pkgsym-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: pkgsym-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for pkgsym-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 841fe5700e491f1c11e69c1fce77cedd8d6f792297ba759e51d311f82b96f013
MD5 da72e62f2d3454921bd837ea1926bf4d
BLAKE2b-256 a175b8a68e0976b94e487501a6f751ee33297200f2d802f2a1fa37e33599585b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page