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

pip3 install no longer adds executable to path #277

Open
kallisti5 opened this issue Nov 1, 2023 · 6 comments
Open

pip3 install no longer adds executable to path #277

kallisti5 opened this issue Nov 1, 2023 · 6 comments

Comments

@kallisti5
Copy link
Member

After the changes @jurgenwigg put in place to modernize haikuporter, pip3 install no longer places haikuporter or haikuporter.py into a PATH. From what I can tell, it no longer even installs haikuporter.py anywhere.

@kallisti5
Copy link
Member Author

# ls -la /usr/local/lib/python3.9/dist-packages/HaikuPorter
total 440
drwxr-xr-x  4 root root  4096 Nov  1 14:24 .
drwxr-xr-x 36 root root  4096 Nov  1 14:24 ..
-rw-r--r--  1 root root 20148 Nov  1 14:24 BuildMaster.py
-rw-r--r--  1 root root 21948 Nov  1 14:24 BuildPlatform.py
drwxr-xr-x  3 root root  4096 Nov  1 14:24 Builders
-rw-r--r--  1 root root  9342 Nov  1 14:24 ConfigParser.py
-rw-r--r--  1 root root 13420 Nov  1 14:24 Configuration.py
-rw-r--r--  1 root root 12450 Nov  1 14:24 DependencyAnalyzer.py
-rw-r--r--  1 root root 10613 Nov  1 14:24 DependencyResolver.py
-rw-r--r--  1 root root  7031 Nov  1 14:24 Display.py
-rw-r--r--  1 root root 30869 Nov  1 14:24 Main.py
-rw-r--r--  1 root root 16954 Nov  1 14:24 Options.py
-rw-r--r--  1 root root 22918 Nov  1 14:24 Package.py
-rw-r--r--  1 root root  6032 Nov  1 14:24 PackageInfo.py
-rw-r--r--  1 root root  7377 Nov  1 14:24 PackageRepository.py
-rw-r--r--  1 root root 16091 Nov  1 14:24 Policy.py
-rw-r--r--  1 root root 54963 Nov  1 14:24 Port.py
-rw-r--r--  1 root root  4442 Nov  1 14:24 ProvidesManager.py
-rw-r--r--  1 root root  5817 Nov  1 14:24 RecipeAttributes.py
-rw-r--r--  1 root root  5056 Nov  1 14:24 RecipeTypes.py
-rw-r--r--  1 root root  2675 Nov  1 14:24 ReleaseChecker.py
-rw-r--r--  1 root root   706 Nov  1 14:24 ReporterJson.py
-rw-r--r--  1 root root  1619 Nov  1 14:24 ReporterMongo.py
-rw-r--r--  1 root root 21485 Nov  1 14:24 Repository.py
-rw-r--r--  1 root root  3108 Nov  1 14:24 RequiresUpdater.py
-rw-r--r--  1 root root 26574 Nov  1 14:24 ShellScriptlets.py
-rw-r--r--  1 root root 17790 Nov  1 14:24 Source.py
-rw-r--r--  1 root root 16947 Nov  1 14:24 SourceFetcher.py
-rw-r--r--  1 root root  8912 Nov  1 14:24 Utils.py
-rw-r--r--  1 root root   134 Nov  1 14:24 __init__.py
drwxr-xr-x  2 root root  4096 Nov  1 14:24 __pycache__
-rw-r--r--  1 root root   129 Nov  1 14:24 __version__.py

@kallisti5
Copy link
Member Author

# pip3 uninstall haikuporter
Found existing installation: haikuporter 1.2.8
Uninstalling haikuporter-1.2.8:
  Would remove:
    /usr/local/lib/python3.9/dist-packages/HaikuPorter/*
    /usr/local/lib/python3.9/dist-packages/haikuporter-1.2.8.dist-info/*

@kallisti5
Copy link
Member Author

for scope, this is currently breaking our buildmaster as it pip3 install's haikuporter

@kallisti5
Copy link
Member Author

python-poetry/poetry#927 seems relevant. (plus moving to a main.py?)

For now I guess i'll just cp haikuporter.py /usr/local/bin/haikuporter as a workaround for the buildmaster.

Reminder to remove my hack from the buildmaster :-)

diff --git a/buildmaster/backend/Dockerfile b/buildmaster/backend/Dockerfile
index 3862d94..4e4ac55 100644
--- a/buildmaster/backend/Dockerfile
+++ b/buildmaster/backend/Dockerfile
@@ -30,6 +30,7 @@ RUN apt-get update \
        && wget https://github.com/jedisct1/minisign/releases/download/0.10/minisign-0.10-linux.tar.gz -O /tmp/minisign.tar.gz \
        && cd /tmp && tar -xvz --strip=2 -f /tmp/minisign.tar.gz && mv minisign /usr/local/bin \
        && pip3 install /tmp/haikuporter \
+       && echo "Bug #277 Fix" && cp /tmp/haikuporter/haikuporter.py /usr/local/bin/haikuporter \
        && cp /tmp/haikuporter/buildmaster/backend/assets/bin/* /usr/local/bin/ \
        && cp /tmp/haikuporter/buildmaster/backend/assets/bootstrap /bin/ \
        && cp /tmp/haikuporter/buildmaster/backend/assets/loop /bin/ \

kallisti5 added a commit that referenced this issue Nov 1, 2023
* Ensure haikuporter cli is in path until tools.poetry is a little
  less melancholy
@OscarL
Copy link
Contributor

OscarL commented Nov 1, 2023

My uncultured stab at this:

Adding a cli.py file under HaikuPorter/ with the following content:

# -*- coding: utf-8 -*-
#
# Copyright 2013-2014 Oliver Tappe
# Distributed under the terms of the MIT License.

import logging

from .Main import Main
from .Options import parseOptions


def main():
	logger = logging.getLogger("buildLogger")
	logger.setLevel(logging.INFO)
	logger.addHandler(logging.StreamHandler())

	Main(*parseOptions())

and then adding the following to pyproject.toml

[tool.poetry.scripts]
haikuporter = "HaikuPorter.cli:main"

Seems to work. I was able to build and install a .whl file using the build package [1]:

> python3 -m build --wheel --no-isolation
* Getting build dependencies for wheel...
* Building wheel...
Successfully built haikuporter-1.2.8-py3-none-any.whl

then I used pip3 install --user dist/haikuporter-1.2.8-py3-none-any.whl, and got a working haikuporter (installed under ~/config/non-packaged/bin), and can import HaikuPorter from a Python3 REPL.

Using python3 -m installer dist/haikuporter-1.2.8-py3-none-any.whl worked too (installing as system package under non-packaged). This seemed to install none of the "extra stuff" that got pulled in when using pip3 install, thou.


This seems to allow to still use haikuporter.py (and its symlink) for those using it from a git clone, while should also work for installing either via pip, or with the build/installer modules (and would allow to resolve the TODO on HaikuPorter's recipe).


[1] Poetry has way too many dependencies for my taste. Even so, after installing it in Haiku, running poetry build -f wheel failed to find python (the .venv looked ok).

@jurgenwigg
Copy link
Contributor

Adding additional file is not needed in this case. I need to check how it is building. Maybe some additional cleanup is needed here.

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

No branches or pull requests

3 participants