• AutonomousHansen's avatar
    Set TZ envar in Docker .bashrc to void babel generating error during docs compilation (#290) · 1387e410
    AutonomousHansen authored
    # Description
    
    Adds a `TZ` envar which corresponds to the timezone of the host
    computer. This is in order to preempt an issue caused by behavior in the
    babel function
    [_get_localzone()](https://github.com/python-babel/babel/blob/a8505a4de1d365d7eac6313908cac6dda2708a05/babel/localtime/_unix.py#L24)
    where the existence of an [empty `/etc/localtime` file
    ](https://github.com/isaac-orbit/orbit/blob/af6447c8fab3d551789272bfb94aad5c88a2ad51/docker/Dockerfile#L62)
    causes our in-container docs compilation to choke with the following
    error:
    
    ```
    root@hhansen-1xl4-500gb:/workspace/orbit# orbit -d
    [INFO] Building documentation...                                                                                                                        
    WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
    WARNING: You are using pip version 21.2.1+nv1; however, version 23.3.1 is available.
    You should consider upgrading via the '/isaac-sim/kit/python/bin/python3 -m pip install --upgrade pip' command.
    Traceback (most recent call last):
      File "/isaac-sim/kit/python/lib/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/isaac-sim/kit/python/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/sphinx/__main__.py", line 3, in <module>
        from sphinx.cmd.build import main
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/sphinx/cmd/build.py", line 20, in <module>
        from sphinx.application import Sphinx
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/sphinx/application.py", line 25, in <module>
        from sphinx.config import Config
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/sphinx/config.py", line 14, in <module>
        from sphinx.util.i18n import format_date
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/sphinx/util/i18n.py", line 12, in <module>
        import babel.dates
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/babel/dates.py", line 34, in <module>
        from babel import localtime
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/babel/localtime/__init__.py", line 41, in <module>
        LOCALTZ = get_localzone()
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/babel/localtime/__init__.py", line 37, in get_localzone
        return _get_localzone()
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/babel/localtime/_unix.py", line 96, in _get_localzone
        return _get_tzinfo_from_file(tzpath)
      File "/isaac-sim/kit/python/lib/python3.10/site-packages/babel/localtime/_helpers.py", line 41, in _get_tzinfo_from_file
        return pytz.tzfile.build_tzinfo('local', tzfile)
      File "/isaac-sim/kit/exts/omni.kit.pip_archive/pip_prebundle/pytz/tzfile.py", line 28, in build_tzinfo
        typecnt, charcnt) = unpack(head_fmt, fp.read(head_size))
    struct.error: unpack requires a buffer of 44 bytes
    There was an error running python
    ```
    The relevant babel function prefers to read timezone information from
    the envar `TZ`, and so setting it in a Docker user's session prevents
    this issue.
    
    ## Type of change
    
    - Bug fix (non-breaking change which fixes an issue)
    
    ## Checklist
    
    - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
    `./orbit.sh --format`
    - [ ] I have made corresponding changes to the documentation
    - [x] My changes generate no new warnings
    - [ ] I have added tests that prove my fix is effective or that my
    feature works
    - [ ] I have updated the changelog and the corresponding version in the
    extension's `config/extension.toml` file
    - [x] I have added my name to the `CONTRIBUTORS.md` or my name already
    exists there
    1387e410
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
docker Loading commit data...
docs Loading commit data...
source Loading commit data...
.dockerignore Loading commit data...
.flake8 Loading commit data...
.gitignore Loading commit data...
.pre-commit-config.yaml Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS.md Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
orbit.sh Loading commit data...
pyproject.toml Loading commit data...