diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 24144e7..0eb1f3f 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -29,7 +29,9 @@ jobs: uses: astral-sh/setup-uv@v6 - name: Install dependencies working-directory: v3 # Set the working directory to v3 where pyproject.toml is located - run: uv sync --all-extras --dev + run: | + sudo apt-get install libldap2-dev libsasl2-dev + uv sync --all-extras --dev - name: Testing with ruff working-directory: v3 # Ensure ruff runs in the correct directory run: uv run ruff check diff --git a/.github/workflows/type-tests.yml b/.github/workflows/type-tests.yml index 749b8e4..756edd4 100644 --- a/.github/workflows/type-tests.yml +++ b/.github/workflows/type-tests.yml @@ -29,7 +29,9 @@ jobs: uses: astral-sh/setup-uv@v6 - name: Install dependencies working-directory: v3 # Set the working directory to v3 where pyproject.toml is located - run: uv sync --all-extras --dev + run: | + sudo apt-get install libldap2-dev libsasl2-dev + uv sync --all-extras --dev - name: Type testing with mypy working-directory: v3 # Ensure mypy runs in the correct directory run: uv run mypy --cache-dir /tmp/ --ignore-missing-imports . diff --git a/v3/.gitignore b/v3/.gitignore index 4f873df..c6dd377 100644 --- a/v3/.gitignore +++ b/v3/.gitignore @@ -1,5 +1,4 @@ steve.db -poetry.lock uv.lock server/bin/bs.zip diff --git a/v3/pyproject.toml b/v3/pyproject.toml index c614f5c..305ebee 100644 --- a/v3/pyproject.toml +++ b/v3/pyproject.toml @@ -24,6 +24,7 @@ Repository = "https://github.com/apache/steve" Issues = "https://github.com/apache/steve/issues" [dependency-groups] +dev = ["faker~=37.8.0", "python-ldap~=3.0.0", { include-group = "lint" }] lint = [ "coverage>=7.10.6,<8", "ruff>=0.14.3", @@ -33,7 +34,6 @@ lint = [ "types-aiofiles>=24.1.0,<25", ] - [build-system] requires = ["uv_build"] build-backend = "uv_build" diff --git a/v3/server/bin/asf-load-ldap.py b/v3/server/bin/asf-load-ldap.py index 8557b6b..161e02a 100755 --- a/v3/server/bin/asf-load-ldap.py +++ b/v3/server/bin/asf-load-ldap.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 + # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,23 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sys import pathlib import logging -import ldap # pip3 install python-ldap -import asfpy.db +import ldap import asfpy.stopwatch from easydict import EasyDict as edict +import steve.persondb + _LOGGER = logging.getLogger(__name__) THIS_DIR = pathlib.Path(__file__).resolve().parent DB_FNAME = THIS_DIR.parent / 'steve.db' -sys.path.insert(0, str(THIS_DIR.parent.parent)) -import steve.persondb # noqa: E402 - # The ASF's LDAP server, available for read-only for finding potential voters. LDAP_URL = 'ldaps://ldap-us.apache.org/' LDAP_DN = 'ou=people,dc=apache,dc=org' diff --git a/v3/server/bin/fetch-bootstrap.sh b/v3/server/bin/fetch-bootstrap.sh index 8d673d3..0ee49ab 100755 --- a/v3/server/bin/fetch-bootstrap.sh +++ b/v3/server/bin/fetch-bootstrap.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash + # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -14,9 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# # Fetch latest bootstrap, and places files into our git working copy. -# #set -x @@ -28,8 +27,8 @@ I_VERSION="1.13.1" I_DIST="bootstrap-icons-${I_VERSION}" I_URL="https://github.com/twbs/icons/releases/download/v${I_VERSION}/${I_DIST}.zip" -THIS_DIR=$(/bin/dirname "`realpath $0`") -PARENT_DIR=$(/bin/dirname "$THIS_DIR") +THIS_DIR=$(dirname "`realpath $0`") +PARENT_DIR=$(dirname "$THIS_DIR") STATIC_DIR="${PARENT_DIR}/static" # -------------------- diff --git a/v3/server/bin/load_fakedata.py b/v3/server/bin/load-fakedata.py similarity index 94% rename from v3/server/bin/load_fakedata.py rename to v3/server/bin/load-fakedata.py index fad994e..79ab6fb 100755 --- a/v3/server/bin/load_fakedata.py +++ b/v3/server/bin/load-fakedata.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 + # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. @@ -13,30 +14,25 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# # Load a bunch of fake data into the database, for stuff to work with. - import argparse import sqlite3 -import sys import pathlib import logging -import faker # pip3 install faker +import faker + +import steve.election +### we shouldn't need this. do so, for now. +import steve.crypto _LOGGER = logging.getLogger(__name__) THIS_DIR = pathlib.Path(__file__).resolve().parent DB_FNAME = THIS_DIR.parent / 'steve.db' -sys.path.insert(0, str(THIS_DIR.parent.parent)) -import steve.election # noqa: E402 - -### we shouldn't need this. do so, for now. -import steve.crypto # noqa: E402 - # Do we need individual instances? Use a singleton for now. FAKE = faker.Faker()