Hi!

On 11/07/2022 21.38, Marcos Cruz wrote:

Hello,

I want to install hgweb.cgi for the first time. I have read the wiki
article (https://www.mercurial-scm.org/wiki/PublishingRepositories) and
have prepared a subdomain of mine with CGI support.

I have the following versions installed:

- The server has Mercurial 3.7.3, Python 2.6.6 and 3.4.3.

- My local system (Debian 10.12) has Mercurial 6.1.4, Python 2.7.16 and
   3.7.3.

I suppose those distant versions of Mercurial must be incompatible in
this case, right?

The basic protocol should be compatible even if the difference in versions is large. However, if one of the peers is using an old version of Mercurial, some features or performance optimizations can’t be used.

My hosting is shared: I can not install anything on the server except in
my home directory. I tried the following: I uploaded the tar.gz of
Mercurial 6.1.4 to the server by FTP. Then, through SSH, I unpacked it
and did `make local`. It failed immediately with the following message:

```
python3 setup.py  \
           build_py -c -d . \                                                   
                        build_ext  -i \
           build_hgexe  -i \
           build_mo
Traceback (most recent call last):
   File "setup.py", line 455, in <module>
     b'version = b"%s"\n' % versionb,
TypeError: unsupported operand type(s) for %: 'bytes' and 'bytes'
make: *** [local] Error 1
```

Could it be an incompatibility between Python 3.4.3 and 3.7.3? I'm not a
Python programmer, I'm just guessing.

Mercurial 6.1.x requires Python 2.7.x or Python >= 3.5. Your Python 3 version is so old that setup.py (which is required to build Mercurial) can’t execute at all. With never versions of Python 3 and setuptools, there should be a better error.

Mercurial >= 6.2 requires Python >= 3.6.

If you’re fine with staying on Mercurial 6.1.4, you can try building it with Python 2.7:

PYTHON=python2 make local

I've found some instructions to update Python on a shared hosting and
they seem quite simple, but I prefer to ask for some advice first. What
do you recommend?

To be clear, which instructions are you referring to?

In general, I would recommend trying to install a newer version of Mercurial via the distribution’s official package manager. That advise is not applicable in your case, of course. Other ways depend on the installation on your particular server and your security requirements.

To build Mercurial without installing it, running `make local` should work on the right Python version, as described above.

If you want to install the Python package, you can install it in the user site-packages directory. For example:

1) Install Mercurial via pip. Whether it’s available and how the executable is called to make it run on the intended Python version depends on the installation on your particular server. In the following, replace `pip` by the correct executable. 1a) `pip install --user mercurial` should hopefully select the right Mercurial version that works on the Python version it’s running with.
1b) `pip install --user .` in the unpacked Mercurial source
2) Run `python2 setup.py install --user` in the unpacked Mercurial source. If you want to use another Python version, replace `python2`.

Thank you in advance.


_______________________________________________
Mercurial mailing list
[email protected]
https://lists.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to