Skip to content

Commit

Permalink
Don't relay PREFIX to setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
otsaloma committed Sep 1, 2022
1 parent 8dfb05b commit d62251c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 28 deletions.
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ PREFIX = /usr/local
DATADIR = $(DESTDIR)$(PREFIX)/share
LOCALEDIR = $(DESTDIR)$(PREFIX)/share/locale

# Allow overriding paths fed to setup-partial.py. This is needed at
# least currently (2022-05-28) on Fedora to avoid '/usr/local/local'.
# Allow overriding setup.py paths. Note that we can't set
# SETUP_PREFIX=PREFIX as many distros are automatically adding
# 'local', causing '/usr/local/local' and a broken install.
# https://bugzilla.redhat.com/show_bug.cgi?id=2026979
SETUP_ROOT = $(DESTDIR)
SETUP_PREFIX = $(PREFIX)
SETUP_PREFIX =

# EDITOR must wait!
EDITOR = nano

# TODO: Use either 'pip3 install' or 'python3 -m build' + 'python3 -m
# installer' once either supports a sensible installation both from
# source (--prefix=/usr/local, whether implicit or explicit) and
# building a distro package (--destdir=pkg --prefix=/usr). As of 9/2022
# it seems setup.py is deprecated, but there is no replacement.

build:
@echo "BUILDING PYTHON PACKAGE..."
./setup-partial.py build
CATAPULT_PREFIX=$(PREFIX) ./setup-partial.py build
@echo "BUILDING TRANSLATIONS..."
mkdir -p build/mo
for LANG in `cat po/LINGUAS`; do \
Expand Down Expand Up @@ -49,7 +56,7 @@ clean:
install:
test -f build/.complete
@echo "INSTALLING PYTHON PACKAGE..."
./setup-partial.py install \
CATAPULT_PREFIX=$(PREFIX) ./setup-partial.py install \
$(if $(SETUP_ROOT),--root=$(SETUP_ROOT),) \
$(if $(SETUP_PREFIX),--prefix=$(SETUP_PREFIX),)
@echo "INSTALLING DATA FILES..."
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ PENDING: Catapult 0.5
=====================

* Specify limited API for plugins under `catapult.api`
* When installing, don't relay `PREFIX` to `setup.py` as many distros
interpret that differently. Use `SETUP_PREFIX` separately if needed,
e.g. for building a distro package, you could use something like `make
DESTDIR=pkg PREFIX=/usr SETUP_PREFIX=/usr install`. See `Makefile` for
details.

2022-06-08: Catapult 0.4.1
==========================
Expand Down
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,6 @@ Then, to install Catapult, run commands
make build
sudo make PREFIX=/usr/local install

<details>
<summary>Using Fedora 36?</summary>

Fedora have [broken][2026979] Python package installation by not
respecing the supplied prefix. To work around the issue, use the
following commands – it will install to `/usr/local` (Fedora
automatically adds `local` to the end of `SETUP_PREFIX`). Only use this
on Fedora 36 (and maybe later, check the linked bug report for the
up-to-date status).

make build
sudo make PREFIX=/usr/local SETUP_PREFIX=/usr install

</details>

[2026979]: https://bugzilla.redhat.com/show_bug.cgi?id=2026979

## Documentation

### Starting Automatically
Expand Down
7 changes: 1 addition & 6 deletions setup-partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ class InstallLib(install_lib):

def install(self):
# Patch installation paths into catapult/__init__.py.
get_command_obj = self.distribution.get_command_obj
root = get_command_obj("install").root
prefix = get_command_obj("install").install_data
if root is not None:
prefix = os.path.abspath(prefix)
prefix = prefix.replace(os.path.abspath(root), "")
prefix = os.getenv("CATAPULT_PREFIX", "/usr/local")
data_dir = Path(prefix) / "share" / "catapult"
locale_dir = Path(prefix) / "share" / "locale"
init_path = Path(self.build_dir) / "catapult" / "__init__.py"
Expand Down

0 comments on commit d62251c

Please sign in to comment.