https://bz.mercurial-scm.org/show_bug.cgi?id=6953

            Bug ID: 6953
           Summary: Installation with pipx or UV is broken on Windows
           Product: Mercurial
           Version: 6.9
          Hardware: PC
                OS: Windows
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Python Version: ---

Installation with pipx or UV is broken on Windows.

There should be a test for this very common case.

With Mercurial 6.9, `pipx install mercurial` creates an environment and
installs some files (hg and hg.bat) in $HOME\.local\bin.

However, these files are wrong (just a copy of the files in the wheel), which
is a know limitation of setuptools scripts (see
https://discuss.python.org/t/whats-the-status-of-scripts-vs-entry-points/18524).
 

Setuptools discourages script-files "Discouraged - equivalent to the script
keyword in setup.py. Whenever possible, please use project.scripts instead."
(https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#setuptools-specific-configuration).

The fix seems simple but has to be based on modern setuptools (i.e. after merge
of https://foss.heptapod.net/mercurial/mercurial-devel/-/merge_requests/1131).

- a main function in hgdemandimport
- declare [project.scripts] in pyproject.toml
- remove code related to hg, hg.bat and hg.exe in setup.py
- move (or remove) the Python script hg

Most Python applications use entry points (for example
https://github.com/psf/black/blob/main/pyproject.toml#L86) so they work well
and are quite efficient.

On Windows, a .exe is created by setuptools when the wheel is installed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
[email protected]
https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to