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

python: fix installed scripts #256

Conversation

ymorin-orange
Copy link
Member

Changes:


How to test:

Pre-requisites:

  • a python 3.11 environment; if you do not have one already, use a container:
    $ docker container run \
        --detach \
        --name iot3 \
        --rm \
        -ti \
        --network host \
        -e http_proxy \
       -e https_proxy \
       -e no_proxy \
        --user $(id -u):$(id -u) \
        --mount type=bind,source=$(pwd),destination=$(pwd) \
        --workdir $(pwd) \
        python:3.11.9-slim-bookworm \
        /bin/bash -il
    $ docker container exec -u 0:0 iot3 apt update
    $ docker container exec -u 0:0 iot3 apt install -y build-essential git
    $ docker container attach iot3
    Note: in the following the $ prompt means running in a shell that has access to python3.11, while the 🐍 $ prompt means running in the activated venv.
  1. Install the its-interqueuemanager package:
    $ python3.11 -m venv /tmp/iqm
    $ . /tmp/iqm/bin/activate
    🐍 $ pip install python/its-interqueuemanager
    🐍 $ /tmp/iqm/bin/its-iqm -h
    🐍 $ deactivate
  2. Install the its-status package:
    $ python3.11 -m venv /tmp/status
    $ . /tmp/status/bin/activate
    🐍 $ pip install python/its-status
    🐍 $ /tmp/status/bin/its-status -h
    🐍 $ deactivate
  3. Install the its-vehicle package (note: due to unpublished python packages, we need to resolve dependencies by hand for now):
    $ python3.11 -m venv /tmp/vehicle
    $ . /tmp/vehicle/bin/activate
    🐍 $ pip install linuxfd==1.5 python/iot3
    🐍 $ pip install --no-deps python/its-vehicle
    🐍 $ /tmp/vehicle/bin/its-vehicle -h
    🐍 $ deactivate

Expected results:

  1. The its-interqueuemanager package installs a script named its-iqm; its-iqm -h displays help for its-iqm.
  2. The its-status package installs a script named its-status; its-status -h displays help for its-status.
  3. The its-vehicle package installs a script named its-status; its-vehicle -h displays help for its-vehicle.

Commit 81ff4ce (python/its-iqm: migrate to PEP517) copied the
pyproject.toml from the its-vehicle package, as a starting point.

In doing so, it forgot to rename the installed script, and to update
its entrypoint as well.

Fix that now.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Commit 5da7ecd (python/its-status: migrate to PEP517) copied the
pyproject.toml from the its-info package as a starting point.

In doing so, it forgot to rename the installed script, and to update
its entrypoint as well.

Fix that now.

Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
@ymorin-orange ymorin-orange added the Python Python code label Dec 24, 2024
@ymorin-orange ymorin-orange added this to the Sprint 6 milestone Dec 24, 2024
@ymorin-orange ymorin-orange self-assigned this Dec 24, 2024
@ymorin-orange ymorin-orange marked this pull request as ready for review December 24, 2024 09:35
@mathieu1fb
Copy link
Collaborator

@ymorin-orange I've been following the full procedure - using a container -, but I am running into the following error after running 🐍 $ pip install python/its-interqueuemanager:

Processing ./python/its-interqueuemanager
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      running egg_info
      creating its_iqm.egg-info
      error: could not create 'its_iqm.egg-info': Permission denied
      [end of output]

Should the container be started with sudo to get the necessary rights?

@ymorin-orange
Copy link
Member Author

@ymorin-orange I've been following the full procedure - using a container -, but I am running into the following error after running 🐍 $ pip install python/its-interqueuemanager:

      error: could not create 'its_iqm.egg-info': Permission denied

This is due to a discrepancy between using a "normal" Docker installation vs. Docker Desktop.

Copy link
Collaborator

@mathieu1fb mathieu1fb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After fixing docker configuration issues on the test machine (should use docker.io and not docker desktop):

Test 1

its-interqueuemanager package install successful.
Command /tmp/iqm/bin/its-iqm -h shows:

usage: its-iqm [-h] [--config CONFIG] [--debug]

options:
  -h, --help            show this help message and exit
  --config CONFIG, -c CONFIG
                        Path to the configuration file (default: /etc/its/iqm.cfg)
  --debug               Print tons of debug messages on stderr

Test 2

its-status package install successful.
Command /tmp/status/bin/its-status -h shows:

usage: its-status [-h] [--config CONFIG]

options:
  -h, --help            show this help message and exit
  --config CONFIG, -c CONFIG
                        Path to the configuration file (default: /etc/its-status/its-status.cfg)

Test 3

its-vehicle package install successful.
Command /tmp/vehicle/bin/its-vehicle -h shows:

usage: its-vehicle [-h] [--config CONFIG] [--debug]

options:
  -h, --help            show this help message and exit
  --config CONFIG, -c CONFIG
                        Path to the configuration file (default: /etc/its/vehicle.cfg)
  --debug, -d           Enable debug messages

PR is approved 👍

@ymorin-orange ymorin-orange merged commit 3c3e9ca into Orange-OpenSource:master Jan 2, 2025
58 checks passed
@ymorin-orange ymorin-orange deleted the nyma/gh-255.its-status-script branch January 2, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python Python code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

python: incorrect scripts installed
2 participants