Changeset - 0a9ddb8cd8c1
[Not reviewed]
stable
0 8 0
Mads Kiilerich - 3 years ago 2023-04-13 13:54:24
mads@kiilerich.com
setup: avoid setuptools 67 - it can't handle celery's broken pytz dependency

With setuptools 67 or later, launching Kallithea fails as:

$ gearbox serve -c my.ini --reload
15:56:54,111 ERROR [gearbox] Expected closing RIGHT_PARENTHESIS
pytz (>dev)
~^

The `packaging` vendored in setuptools cannot handle the broken syntax
`Requires-Dist: pytz (>dev)` in
venv/lib/python3.11/site-packages/celery-5.0.5.dist-info/METADATA .

The old celery version currently used by Kallithea is wrong, and setuptools has
moved on after a reasonable grace period. We thus have to work around and avoid
latest setuptools.

See https://github.com/pypa/setuptools/issues/3889 .
8 files changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
Jenkinsfile
Show inline comments
 
@@ -19,25 +19,25 @@ node {
 
    stage('checkout') {
 
        checkout scm
 
        if (isUnix()) {
 
            sh 'hg --config extensions.purge= purge --all'
 
        } else {
 
            bat 'hg --config extensions.purge= purge --all'
 
        }
 
    }
 
    stage('virtual env') {
 
        def virtualenvscript = """$createvirtualenv
 
            $activatevirtualenv
 
            python -m pip install --upgrade pip
 
            pip install --upgrade setuptools
 
            pip install --upgrade "setuptools<67"
 
            pip install --upgrade pylint
 
            pip install --upgrade pytest-cov
 
            """
 
        if (isUnix()) {
 
            virtualenvscript += """
 
                pip install --upgrade python-ldap
 
                pip install --upgrade python-pam
 
                """
 
            sh virtualenvscript
 
        } else {
 
            bat virtualenvscript
 
        }
docs/contributing.rst
Show inline comments
 
@@ -24,25 +24,25 @@ for more details.
 

	
 

	
 
Getting started
 
---------------
 

	
 
To get started with Kallithea development run the following commands in your
 
bash shell::
 

	
 
        hg clone https://kallithea-scm.org/repos/kallithea
 
        cd kallithea
 
        python3 -m venv venv
 
        . venv/bin/activate
 
        pip install --upgrade pip setuptools
 
        pip install --upgrade pip "setuptools<67"
 
        pip install --upgrade -e . -r dev_requirements.txt python-ldap python-pam
 
        kallithea-cli config-create my.ini
 
        kallithea-cli db-create -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
 
        kallithea-cli front-end-build
 
        gearbox serve -c my.ini --reload &
 
        firefox http://127.0.0.1:5000/
 

	
 

	
 
Contribution flow
 
-----------------
 

	
 
Starting from an existing Kallithea clone, make sure it is up to date with the
docs/installation.rst
Show inline comments
 
@@ -46,25 +46,25 @@ reasonable set of dependencies is instal
 

	
 

	
 
Installation from repository source
 
-----------------------------------
 

	
 
To install Kallithea in a virtualenv using the stable branch of the development
 
repository, use the following commands in your bash shell::
 

	
 
        hg clone https://kallithea-scm.org/repos/kallithea -u stable
 
        cd kallithea
 
        python3 -m venv venv
 
        . venv/bin/activate
 
        pip install --upgrade pip setuptools
 
        pip install --upgrade pip "setuptools<67"
 
        pip install --upgrade -e .
 
        python3 setup.py compile_catalog   # for translation of the UI
 

	
 
.. note::
 
   This will install all Python dependencies into the virtualenv. Kallithea
 
   itself will however only be installed as a pointer to the source location.
 
   The source clone must thus be kept in the same location, and it shouldn't be
 
   updated to other revisions unless you want to upgrade. Edits in the source
 
   tree will have immediate impact (possibly after a restart of the service).
 

	
 
You can now proceed to :ref:`prepare-front-end-files`.
 

	
 
@@ -89,25 +89,25 @@ An additional benefit of virtualenv is t
 
  directory as root if necessary and grant ownership to the ``kallithea`` user.
 

	
 
- Create a new virtual environment, for example in ``/srv/kallithea/venv``,
 
  specifying the right Python binary::
 

	
 
    python3 -m venv /srv/kallithea/venv
 

	
 
- Activate the virtualenv in your current shell session and make sure the
 
  basic requirements are up-to-date by running the following commands in your
 
  bash shell::
 

	
 
    . /srv/kallithea/venv/bin/activate
 
    pip install --upgrade pip setuptools
 
    pip install --upgrade pip "setuptools<67"
 

	
 
.. note:: You can't use UNIX ``sudo`` to source the ``activate`` script; it
 
   will "activate" a shell that terminates immediately.
 

	
 
- Install Kallithea in the activated virtualenv::
 

	
 
    pip install --upgrade kallithea
 

	
 
.. note:: Some dependencies are optional. If you need them, install them in
 
   the virtualenv too::
 

	
 
     pip install --upgrade kallithea python-ldap python-pam psycopg2
docs/installation_win.rst
Show inline comments
 
@@ -95,25 +95,25 @@ In order to install Kallithea, you need 
 
Some Python packages use managed code and need to be compiled.
 
This can be done on Linux without any special steps. On Windows, you will need to install Microsoft Visual C++ compiler for Python 3.8.
 

	
 
Download and install "Microsoft Visual C++ Compiler for Python 3.8" from http://aka.ms/vcpython27
 

	
 
.. note::
 
  You can also install the dependencies using already compiled Windows binaries packages. A good source of compiled Python packages is http://www.lfd.uci.edu/~gohlke/pythonlibs/. However, not all of the necessary packages for Kallithea are on this site and some are hard to find, so we will stick with using the compiler.
 

	
 
In a command prompt type (adapting paths if necessary)::
 

	
 
  cd C:\Kallithea\Env\Scripts
 
  activate
 
  pip install --upgrade pip setuptools
 
  pip install --upgrade pip "setuptools<67"
 

	
 
The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
 
(depending of your folder structure). Then type::
 

	
 
  pip install kallithea
 

	
 
.. note:: This will take some time. Please wait patiently until it is fully
 
          complete. Some warnings will appear. Don't worry, they are
 
          normal.
 

	
 
Step 8 -- Install Git (optional)
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docs/installation_win_old.rst
Show inline comments
 
@@ -161,25 +161,25 @@ Command Prompt (**IMPORTANT!!**). To do 
 
Change commandline from::
 

	
 
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86
 

	
 
to::
 

	
 
%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" amd64
 

	
 
In that CMD (loaded with VS2008 PATHs) type::
 

	
 
  cd C:\Kallithea\Env\Scripts (or similar)
 
  activate
 
  pip install --upgrade pip setuptools
 
  pip install --upgrade pip "setuptools<67"
 

	
 
The prompt will change into "(Env) C:\\Kallithea\\Env\\Scripts" or similar
 
(depending of your folder structure). Then type::
 

	
 
 pip install kallithea
 

	
 
(long step, please wait until fully complete)
 

	
 
Some warnings will appear, don't worry as they are normal.
 

	
 
Step 8 -- Configuring Kallithea
 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scripts/dbmigrate-test
Show inline comments
 
@@ -85,25 +85,25 @@ fi
 
install_kallithea() {
 
    local prefix=$1
 
    local rev=$2
 

	
 
    announce "Installing Kallithea $rev in $prefix..."
 

	
 
    "${VIRTUALENV:-virtualenv}" --quiet "$prefix-env"
 
    HG archive --rev "$rev" "$prefix"
 

	
 
    (
 
        cd "$prefix"
 
        . "$prefix-env/bin/activate"
 
        pip install --quiet --upgrade pip setuptools mercurial $EXTRA
 
        pip install --quiet --upgrade pip "setuptools<67" mercurial $EXTRA
 
        pip install --quiet -e .
 
    )
 
}
 

	
 
install_kallithea "$temp/from" "$from_rev_hash"
 
(
 
    cd "$temp/from"
 
    . "$temp/from-env/bin/activate"
 
    announce "Initializing database..."
 
    quiet_if_ok kallithea-cli db-create -c "$config_file" --repos="$temp/repos" --user=doe --email=doe@example.com --password=123456 --no-public-access --force-yes
 
    alembic -c "$config_file" current -v
 
)
scripts/validate-commits
Show inline comments
 
@@ -33,25 +33,25 @@ finish()
 
    cat "$resultfile"
 
    rm "$resultfile"
 
}
 
trap finish EXIT
 

	
 
for rev in $(hg log -r "$revset" -T '{node}\n'); do
 
    hg log -r "$rev"
 
    hg update "$rev"
 

	
 
    cleanup
 
    python3 -m venv "$venv"
 
    source "$venv/bin/activate"
 
    pip install --upgrade pip setuptools
 
    pip install --upgrade pip "setuptools<67"
 
    pip install -e . -r dev_requirements.txt python-ldap python-pam
 

	
 
    # run-all-cleanup
 
    if ! scripts/run-all-cleanup ; then
 
        echo "run-all-cleanup encountered errors!"
 
        result="NOK"
 
    else
 
        if ! hg update --check -q .; then
 
            echo "run-all-cleanup did not give clean results!"
 
            result="NOK"
 
            hg diff
 
            hg revert -a
scripts/validate-minimum-dependency-versions
Show inline comments
 
@@ -21,25 +21,25 @@ echo "minimum requirements file: $min_re
 
# clean up previous runs
 
rm -rf "$venv" "$log"
 
mkdir -p "$venv"
 

	
 
# Make a light weight parsing of setup.py and dev_requirements.txt,
 
# finding all >= requirements and dumping into a custom requirements.txt
 
# while fixating the requirement at the lower bound.
 
sed -n 's/.*"\(.*\)>=\(.*\)".*/\1==\2/p' setup.py > "$min_requirements"
 
sed 's/>=/==/p' dev_requirements.txt >> "$min_requirements"
 

	
 
python3 -m venv "$venv"
 
source "$venv/bin/activate"
 
pip install --upgrade pip setuptools
 
pip install --upgrade pip "setuptools<67"
 
pip install -e . -r "$min_requirements" python-ldap python-pam 2> >(tee "$log" >&2)
 

	
 
# Treat any message on stderr as a problem, for the caller to interpret.
 
if [ -s "$log" ]; then
 
    echo
 
    echo "Error: pip detected following problems:"
 
    cat "$log"
 
    echo
 
    exit 1
 
fi
 

	
 
freeze_txt=build/minimum-dependency-versions.txt
0 comments (0 inline, 0 general)