Skip to content

Add headless mode#61

Open
heijligen wants to merge 1 commit intohdtv-tool:masterfrom
heijligen:headless
Open

Add headless mode#61
heijligen wants to merge 1 commit intohdtv-tool:masterfrom
heijligen:headless

Conversation

@heijligen
Copy link
Contributor

Add a CLI option, --headless, which monkey patches the GUI like the tests to use the headless dummy one.

Having this is useful for running HDTV dozens of times from a script.


I just saw the monkey_patch_ui function and had the idea to use it.
I'm open to create a real patch or discard this.


@h-mayr : This was on our wishlist. Can you test is?

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.82%. Comparing base (4374fa9) to head (7b0654d).
⚠️ Report is 33 commits behind head on master.

Files with missing lines Patch % Lines
src/hdtv/app.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #61      +/-   ##
==========================================
- Coverage   63.07%   62.82%   -0.26%     
==========================================
  Files          70       69       -1     
  Lines       10066     9874     -192     
==========================================
- Hits         6349     6203     -146     
+ Misses       3717     3671      -46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

Yes, but I cannot get it to run atm. Not sure why, I get the following error:

(hdtv) $ uv run hdtv
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.13`.
   Built hdtv @ file:///home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv
Installed 38 packages in 24ms
-- The CXX compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find Vdt (missing: VDT_INCLUDE_DIR VDT_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /home/hmayr/Downloads/root/cmake/modules/FindVdt.cmake:63 (find_package_handle_standard_args)
  /usr/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /home/hmayr/Downloads/root/cmake/ROOTConfig.cmake:168 (find_dependency)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/.venv/bin/hdtv", line 10, in <module>
    sys.exit(run())
             ~~~^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/app.py", line 231, in run
    App()
    ~~~^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/app.py", line 125, in __init__
    import hdtv.session
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/session.py", line 26, in <module>
    import hdtv.cal
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/cal.py", line 28, in <module>
    import hdtv.rootext.calibration
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/calibration.py", line 3, in <module>
    hdtv.rootext.dlmgr.LoadLibrary("calibration")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/dlmgr.py", line 76, in LoadLibrary
    fname = BuildLibrary(name, usrdir)
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/dlmgr.py", line 105, in BuildLibrary
    subprocess.check_call(
    ~~~~~~~~~~~~~~~~~~~~~^
        [
        ^
    ...<5 lines>...
        cwd=tmpdir,
        ^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/calibration', '-DCMAKE_INSTALL_PREFIX=/home/hmayr/.cache/hdtv/51185136-63606-24.10+29.g4af31e7', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.

I also saw that the Readme might not be up to date. At least uv is telling me that there is no option --system-site as mentioned in the development section but only --system-site-packages.

@heijligen
Copy link
Contributor Author

Oh, than there is an error in the README. I't should only be uv venv --system-site-packages. I'll fix it.

This root-project/root#14163 seems to be related to your issue. If you have docker, you can try the container.

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

Both, with and without docker I get the error message that I would install from a shallow clone which is not supported. Unshallowing does not work since it is not a shallow clone according to git...

@heijligen
Copy link
Contributor Author

Do you get the same output as before? Can you otherwise paste your failing buildlog?

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

This is on the headless branch of your fork. The same error occurs, when running e.g. uv sync.

(hdtv)$ uv run hdtv
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.13`.
  × Failed to build `hdtv @ file:///home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_editable` failed (exit status: 1)

      [stderr]
      Traceback (most recent call last):
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/git.py", line 347,
      in describe_git_core
          tag, distance, rev = Describe.parse(description)
                               ~~~~~~~~~~~~~~^^^^^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/git.py", line 58, in
      parse
          raise ValueError("Could not parse `git describe` output")
      ValueError: Could not parse `git describe` output

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/hook.py", line 23,
      in setuptools_finalizer
          report = vgit.run(write=True, fallback=True)
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/core.py", line 272,
      in run
          description = self.do_vcs()
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/core.py", line 336,
      in do_vcs
          description = self.vcs(project_dir=self.project_dir)
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/methods.py", line 162,
      in __call__
          return self.method(params=self.params, **kwargs)
                 ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/git.py", line 230,
      in describe_git
          vdesc = describe_git_core(
              repo,
          ...<2 lines>...
              DescribeOpts(tags=True, match=match, exclude=exclude),
          )
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/git.py", line 360,
      in describe_git_core
          raise NoTagError(f"`{opts.as_cmdline_str()}` could not find a tag")
      versioningit.errors.NoTagError: `git describe --long --dirty --always --tags` could not find a tag

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 14, in <module>
          requires = get_requires_for_build({})
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/build_meta.py", line 479,
      in get_requires_for_build_editable
          return self.get_requires_for_build_wheel(config_settings)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/build_meta.py", line 333,
      in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/build_meta.py", line 301,
      in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/build_meta.py", line 317,
      in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 1, in <module>
          import sys
      
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/__init__.py", line 117,
      in setup
          return distutils.core.setup(**attrs)  # type: ignore[return-value]
                 ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/_distutils/core.py", line
      148, in setup
          _setup_distribution = dist = klass(attrs)
                                       ~~~~~^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/dist.py", line 321, in
      __init__
          _Distribution.__init__(self, dist_attrs)
          ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/_distutils/dist.py", line
      309, in __init__
          self.finalize_options()
          ~~~~~~~~~~~~~~~~~~~~~^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/setuptools/dist.py", line 790, in
      finalize_options
          ep(self)
          ~~^^^^^^
        File "/home/hmayr/.cache/uv/builds-v0/.tmpZ8oQeA/lib/python3.13/site-packages/versioningit/hook.py", line 28,
      in setuptools_finalizer
          raise RuntimeError(
          ...<7 lines>...
          )
      RuntimeError:
      versioningit could not find a version for the project in /home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv!

      You may be installing from a shallow clone, in which case you need to unshallow it first.

      Alternatively, you may be installing from a Git archive, which is not supported by default.  Install from a
      git+https://... URL instead.



      hint: This usually indicates a problem with the package or the build environment.

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

The same comes wrapped in docker logic:

(hdtv)$ sudo docker build --tag hdtv .
[+] Building 8.0s (9/10)                                                                                                                                                               docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                             0.0s
 => => transferring dockerfile: 451B                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/rootproject/root:6.34.00-ubuntu24.04                                                                                                                  1.0s
 => [internal] load .dockerignore                                                                                                                                                                0.0s
 => => transferring context: 51B                                                                                                                                                                 0.0s
 => [1/6] FROM docker.io/rootproject/root:6.34.00-ubuntu24.04@sha256:3b46b2e131ade9b2758f7e28cde783893c3ec376645763ebe415b7f97dad9aa6                                                            0.0s
 => => resolve docker.io/rootproject/root:6.34.00-ubuntu24.04@sha256:3b46b2e131ade9b2758f7e28cde783893c3ec376645763ebe415b7f97dad9aa6                                                            0.0s
 => [internal] load build context                                                                                                                                                                0.1s
 => => transferring context: 8.52MB                                                                                                                                                              0.1s
 => CACHED [2/6] RUN apt-get update -y &&     apt-get install -y --no-install-recommends pipx xvfb &&     rm -rf /var/lib/apt/lists/*                                                            0.0s
 => CACHED [3/6] WORKDIR /install                                                                                                                                                                0.0s
 => [4/6] COPY . /install                                                                                                                                                                        0.1s
 => ERROR [5/6] RUN python3 -m pipx install . &&     bash -c "Xvfb :0 -screen 0 1024x768x16 &" &&     DISPLAY=:0 hdtv --rebuild-usr --execute exit                                               6.8s
------                                                                                                                                                                                                
 > [5/6] RUN python3 -m pipx install . &&     bash -c "Xvfb :0 -screen 0 1024x768x16 &" &&     DISPLAY=:0 hdtv --rebuild-usr --execute exit:                                                          
0.556 creating virtual environment...                                                                                                                                                                 
0.597 creating shared libraries...                                                                                                                                                                    
3.312 upgrading shared libraries...
4.887 determining package name from '/install'...
6.743   error: subprocess-exited-with-error
6.743   
6.743   × Getting requirements to build wheel did not run successfully.
6.743   │ exit code: 1
6.743   ╰─> [71 lines of output]
6.743       Traceback (most recent call last):
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/git.py", line 347, in describe_git_core
6.743           tag, distance, rev = Describe.parse(description)
6.743                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/git.py", line 58, in parse
6.743           raise ValueError("Could not parse `git describe` output")
6.743       ValueError: Could not parse `git describe` output
6.743       
6.743       During handling of the above exception, another exception occurred:
6.743       
6.743       Traceback (most recent call last):
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/hook.py", line 23, in setuptools_finalizer
6.743           report = vgit.run(write=True, fallback=True)
6.743                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/core.py", line 272, in run
6.743           description = self.do_vcs()
6.743                         ^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/core.py", line 336, in do_vcs
6.743           description = self.vcs(project_dir=self.project_dir)
6.743                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/methods.py", line 162, in __call__
6.743           return self.method(params=self.params, **kwargs)
6.743                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/git.py", line 230, in describe_git
6.743           vdesc = describe_git_core(
6.743                   ^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/git.py", line 360, in describe_git_core
6.743           raise NoTagError(f"`{opts.as_cmdline_str()}` could not find a tag")
6.743       versioningit.errors.NoTagError: `git describe --long --dirty --always --tags` could not find a tag
6.743       
6.743       During handling of the above exception, another exception occurred:
6.743       
6.743       Traceback (most recent call last):
6.743         File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
6.743           main()
6.743         File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
6.743           json_out["return_val"] = hook(**hook_input["kwargs"])
6.743                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/root/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
6.743           return hook(config_settings)
6.743                  ^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
6.743           return self._get_build_requires(config_settings, requirements=[])
6.743                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
6.743           self.run_setup()
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 317, in run_setup
6.743           exec(code, locals())
6.743         File "<string>", line 1, in <module>
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 117, in setup
6.743           return distutils.core.setup(**attrs)  # type: ignore[return-value]
6.743                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 148, in setup
6.743           _setup_distribution = dist = klass(attrs)
6.743                                        ^^^^^^^^^^^^
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 321, in __init__
6.743           _Distribution.__init__(self, dist_attrs)
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 309, in __init__
6.743           self.finalize_options()
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 790, in finalize_options
6.743           ep(self)
6.743         File "/tmp/pip-build-env-2x_9w1gs/overlay/lib/python3.12/site-packages/versioningit/hook.py", line 28, in setuptools_finalizer
6.743           raise RuntimeError(
6.743       RuntimeError:
6.743       versioningit could not find a version for the project in /install!
6.743       
6.743       You may be installing from a shallow clone, in which case you need to unshallow it first.
6.743       
6.743       Alternatively, you may be installing from a Git archive, which is not supported by default.  Install from a git+https://... URL instead.
6.743       
6.743       
6.743       [end of output]
6.743   
6.743   note: This error originates from a subprocess, and is likely not a problem with pip.
6.743 ERROR: Failed to build 'file:///install' when getting requirements to build wheel
6.744 Cannot determine package name from spec '/install'. Check package spec for
6.744 errors.
------

 1 warning found (use docker --debug to expand):
 - JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 19)
Dockerfile:14
--------------------
  13 |     
  14 | >>> RUN python3 -m pipx install . && \
  15 | >>>     bash -c "Xvfb :0 -screen 0 1024x768x16 &" && \
  16 | >>>     DISPLAY=:0 hdtv --rebuild-usr --execute exit
  17 |     
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c python3 -m pipx install . &&     bash -c \"Xvfb :0 -screen 0 1024x768x16 &\" &&     DISPLAY=:0 hdtv --rebuild-usr --execute exit" did not complete successfully: exit code: 1

@heijligen
Copy link
Contributor Author

Thanks. It seams to be a problem with generating the version information if the git checkout is shallow.
I found https://versioningit.readthedocs.io/en/stable/notes.html#restrictions-caveats updating the versioningit config in pyproject.toml should solve it

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

Updating with what?
The repo does not contain any tags. Creating a new tag also does not work. Using "git-archive" instead of "git" in versioningit.vcs does not change the error.

@heijligen
Copy link
Contributor Author

I've introduced versioningit in 8edb124
The given config fails in a shallow clone because it calls git describe wich has no information in that case. A bit more config is required to build also in a shallow clone

@heijligen
Copy link
Contributor Author

Ok, there were two parts to it.

  1. The versioningit config can be improved.
  2. My fork had no release tags. So even with a full clone versioningit couldn't find anything.
    I'm working with a split repo config. I've cloned this repo and fetch from here. But push to my fork.
    origin	git@github.com:janmayer/hdtv.git (fetch)
    origin	git@github.com:heijligen/hdtv.git (push)
    
    This comes closest to the Gerrit workflow I'm used to.
    I fetch PR's with git fetch origin pull/<PR_NUMBER>/head && git checkout FETCH_HEAD

Now I've pushed the tags also to my fork. Pulling again might be the trick.

I'll create a better versioningit config that can deal with this issues.

@heijligen
Copy link
Contributor Author

I've rebased this on top of the versioningit patch #63. Now it should work

@h-mayr
Copy link
Contributor

h-mayr commented Jan 23, 2026

Not sure, if I forgot something. But after pulling I get still the same error, now with the latest tag (24.03) of hdtv in the error message.

(hdtv) $ uv run hdtv
warning: No `requires-python` value found in the workspace. Defaulting to `>=3.13`.
-- The CXX compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find Vdt (missing: VDT_INCLUDE_DIR VDT_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  /home/hmayr/Downloads/root/cmake/modules/FindVdt.cmake:63 (find_package_handle_standard_args)
  /usr/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /home/hmayr/Downloads/root/cmake/ROOTConfig.cmake:168 (find_dependency)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/.venv/bin/hdtv", line 10, in <module>
    sys.exit(run())
             ~~~^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/app.py", line 240, in run
    App()
    ~~~^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/app.py", line 129, in __init__
    import hdtv.session
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/session.py", line 26, in <module>
    import hdtv.cal
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/cal.py", line 28, in <module>
    import hdtv.rootext.calibration
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/calibration.py", line 3, in <module>
    hdtv.rootext.dlmgr.LoadLibrary("calibration")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/dlmgr.py", line 76, in LoadLibrary
    fname = BuildLibrary(name, usrdir)
  File "/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/dlmgr.py", line 105, in BuildLibrary
    subprocess.check_call(
    ~~~~~~~~~~~~~~~~~~~~~^
        [
        ^
    ...<5 lines>...
        cwd=tmpdir,
        ^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/home/hmayr/Dokumente/Promotion/Software/hdtv_headless/hdtv/src/hdtv/rootext/calibration', '-DCMAKE_INSTALL_PREFIX=/home/hmayr/.cache/hdtv/51185136-63606-24.3+38.g7b0654d', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.

@heijligen
Copy link
Contributor Author

On which Linux distribution are you?

@heijligen
Copy link
Contributor Author

Something with your ROOT installation seems to be messed up.

I get it running in podman / docker with those steps

~> git clone https://github.com/heijligen/hdtv hdtv_heijligen
~> cd hdtv_heijligen
~> podman build --tag hdtv .

To start HDTV in normal mode, run

~> podman run -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/work -it hdtv

To start HDTV without display, run

~> podman run -v $(pwd):/work -it hdtv hdtv --headless

(yes, 2 times hdtv. The 1st ist the image name, the 2nd the command to execute)

@h-mayr
Copy link
Contributor

h-mayr commented Jan 27, 2026

I am on Debian and was not able to run hdv with GUI:

$ podman run -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $(pwd):/work -it hdtv
Authorization required, but no authorization protocol specified

 *** Break *** segmentation violation
 Generating stack trace...
 0x00007f49a9333faa in HDTV::Display::Viewer::Viewer(unsigned int, unsigned int, char const*) + 0x3a from /root/.cache/hdtv/51119088-63400-24.10+31.g7b0654d.dirty/lib/libdisplay.so
 0x00007f49a92b207d in <unknown function>
 0x00007f49c549796f in <unknown> from /opt/root/lib/libcppyy_backend.so
 0x00007f49c5498e60 in Cppyy::CallConstructor(long, unsigned long, unsigned long, void*) + 0x30 from /opt/root/lib/libcppyy_backend.so
 0x00007f49ab66a2ca in <unknown> from /opt/root/lib/libcppyy.so
 0x00007f49ab66dd28 in CPyCppyy::CPPMethod::ExecuteProtected(void*, long, CPyCppyy::CallContext*) + 0x178 from /opt/root/lib/libcppyy.so
 0x00007f49ab66c22a in CPyCppyy::CPPMethod::Execute(void*, long, CPyCppyy::CallContext*) + 0x2a from /opt/root/lib/libcppyy.so
 0x00007f49ab660792 in CPyCppyy::CPPConstructor::Call(CPyCppyy::CPPInstance*&, _object* const*, unsigned long, _object*, CPyCppyy::CallContext*) + 0x352 from /opt/root/lib/libcppyy.so
 0x00007f49ab673de8 in <unknown> from /opt/root/lib/libcppyy.so
 0x000000000054aaa1 in _PyObject_Call_Prepend + 0x111 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000059de4f in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000599923 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000549205 in _PyObject_MakeTpCall + 0x75 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000005d7109 in _PyEval_EvalFrameDefault + 0xa89 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000054aa52 in _PyObject_Call_Prepend + 0xc2 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000059de4f in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000599923 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000549205 in _PyObject_MakeTpCall + 0x75 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000005d7109 in _PyEval_EvalFrameDefault + 0xa89 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000054aa52 in _PyObject_Call_Prepend + 0xc2 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000059de4f in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000599923 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000549205 in _PyObject_MakeTpCall + 0x75 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000005d7109 in _PyEval_EvalFrameDefault + 0xa89 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000054aa52 in _PyObject_Call_Prepend + 0xc2 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x000000000059de4f in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000599923 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x0000000000549205 in _PyObject_MakeTpCall + 0x75 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000005d7109 in _PyEval_EvalFrameDefault + 0xa89 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000005d564b in PyEval_EvalCode + 0x15b from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006087b2 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006b4853 in <unknown> from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006b45ba in _PyRun_SimpleFileObject + 0x1aa from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006b43ef in _PyRun_AnyFileObject + 0x4f from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006bc455 in Py_RunMain + 0x3b5 from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00000000006bbf3d in Py_BytesMain + 0x2d from /root/.local/share/pipx/venvs/hdtv/bin/python
 0x00007f49c5d5e1ca in <unknown> from /lib/x86_64-linux-gnu/libc.so.6
 0x00007f49c5d5e28b in __libc_start_main + 0x8b from /lib/x86_64-linux-gnu/libc.so.6
 0x00000000006574f5 in _start + 0x25 from /root/.local/share/pipx/venvs/hdtv/bin/python
Traceback (most recent call last):
ERROR: History file '/root/.local/share/hdtv/hdtv_history' is read-only, will be discarded
  File "/root/.local/bin/hdtv", line 7, in <module>
    sys.exit(run())
             ^^^^^
  File "/root/.local/share/pipx/venvs/hdtv/lib/python3.12/site-packages/hdtv/app.py", line 240, in run
    App()
  File "/root/.local/share/pipx/venvs/hdtv/lib/python3.12/site-packages/hdtv/app.py", line 135, in __init__
    spectra = hdtv.session.Session()
              ^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/share/pipx/venvs/hdtv/lib/python3.12/site-packages/hdtv/session.py", line 45, in __init__
    self.window = Window()
                  ^^^^^^^^
  File "/root/.local/share/pipx/venvs/hdtv/lib/python3.12/site-packages/hdtv/window.py", line 218, in __init__
    self.viewer = ROOT.HDTV.Display.Viewer()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
cppyy.ll.SegmentationViolation: Viewer::Viewer(UInt_t w = 800, UInt_t h = 400, const char* title = "hdtv") =>
    SegmentationViolation: segfault in C++; program state was reset

But: It worked well in headless mode! I've tested it with an example file and it returned the same values as fitted with GUI :)

@heijligen
Copy link
Contributor Author

But: It worked well in headless mode! I've tested it with an example file and it returned the same values as fitted with GUI :)
That's great

For real gui error in docker/podman, try
podman run -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix -v ${PWD}:/work -v ${XAUTHORITY}:/root/.Xauthority -it hdtv

(see #58 patch 1)

Add a CLI option, `--headless`, which monkey patches the GUI like the tests
to use the headless dummy one.

Having this is useful for running HDTV dozens of times from a script.
@heijligen heijligen marked this pull request as ready for review January 27, 2026 18:45
@heijligen heijligen requested a review from op3 February 1, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants