osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
559 stars 73 forks source link

"SyntaxError: invalid syntax" at os_detect_ on Ubuntu 16.04 #143

Closed 130s closed 3 years ago

130s commented 3 years ago

Problem

Dev-installing the latest main on 16.04 (where Python3 is 3.5) I get this. Confirmed on a native host and a Docker container.

Citing the result from Docker container. ``` $ docker run -it -v /home/noodle/repos/osrf/rocker:/cws/rocker ubuntu:xenial bash root@f1c29e17b557:/# apt update # cd %ROCKER% && git log --oneline -2 7351432 (HEAD -> feature-mount, plusone-robotics/feature-mount) Document --volume a735938 [volume] Rename from 'mount' (addressing https://github.com/osrf/rocker/pull/46#discussion_r301416615) # pip3 install --user . # find ~/.local/ -iname rocker* /root/.local/bin/rocker /root/.local/lib/python3.5/site-packages/rocker /root/.local/lib/python3.5/site-packages/rocker-0.2.3.egg-info root@f1c29e17b557:/cws/rocker# /root/.local/bin/rocker --help Traceback (most recent call last): File "/root/.local/bin/rocker", line 9, in load_entry_point('rocker==0.2.3', 'console_scripts', 'rocker')() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point return ep.load() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2229, in load return self.resolve() File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2235, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/root/.local/lib/python3.5/site-packages/rocker/cli.py", line 26, in from .os_detector import detect_os File "/root/.local/lib/python3.5/site-packages/rocker/os_detector.py", line 60 tag="rocker:" + f"os_detect_{image_name}".replace(':', '_').replace('/', '_') ^ SyntaxError: invalid syntax root@f1c29e17b557:/cws/rocker# python3 --version Python 3.5.2 ```

Although, this doesn't happen with the version 0.2.3 taken from apt.

Potential fix

Ubuntu 16.04 is ending the life and Py3.5 has EoLed. So I'm not sure how much we want to fix this?

130s commented 3 years ago

Although, this doesn't happen with the version 0.2.3 taken from apt.

The result in OP was from the branch in https://github.com/osrf/rocker/pull/142 but even I switched to main, the same happens.

$ git log --oneline -2
9d7a392 (HEAD -> main, origin/master, origin/main, origin/HEAD) add an action to mirror main to master Providing backwards compatibility for renaming master to main
695734c git extension supporting user override and full coverage (#138)
130s commented 3 years ago

Since I have a project with Ubuntu 16.04 and it's unclear when we'd switch to OS with newer Python, I made https://github.com/osrf/rocker/pull/144.

malban commented 3 years ago

Although, this doesn't happen with the version 0.2.3 taken from apt.

Now that 0.2.4 is the version apt installs for xenial, the 0.2.4 xenial apt package is broken.

It should be a trivial change to fix:

tag="rocker:" + f"os_detect_{image_name}".replace(':', '_').replace('/', '_')

to

tag="rocker:" + "os_detect_{}".format(image_name).replace(':', '_').replace('/', '_')
tfoote commented 3 years ago

I'm going to close this as xenial is EOL and which was the last python 3.5 platform.