Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ jobs:
pull-requests: write

steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
56 changes: 56 additions & 0 deletions .github/workflows/update-rpm-and-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Update RPM Spec and Sync

on:
workflow_run:
workflows: ["Publish Python Package"] # Listens for your existing publish action
types:
- completed

jobs:
update-and-sync:
runs-on: ubuntu-latest
# Only run if the PyPI publish actually succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git fetch origin

- name: Update RPM spec version on latest
run: |
git checkout latest

# Extract version from your __init__.py file
VERSION=$(grep -oP "^__version__ = ['\"]([^'\"]+)['\"]" src/quads_lib/__init__.py | grep -oP "[0-9]+\.[0-9]+\.[0-9]+")
echo "Extracted version: $VERSION"

# Update the spec file
sed -i "s/^%define version.*/%define version $VERSION/" rpm/quads-lib.spec

# Commit and push if there are changes
git add rpm/quads-lib.spec
if ! git diff --staged --quiet; then
# Added [skip ci] so this commit doesn't accidentally trigger other tests
git commit -m "chore: update RPM spec version to $VERSION [skip ci]"
git push origin latest
echo "Updated RPM spec to version $VERSION on latest"
else
echo "No version changes to commit"
fi

- name: Sync back to development
run: |
git checkout development
# Merge the updated latest branch into development
git merge origin/latest --no-edit
git push origin development
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ You can also install the in-development version with::

pip install https://github.com/quadsproject/python-quads-lib/archive/development.zip

RPM Installation
----------------

For Fedora Linux::

dnf copr enable quadsdev/python3-quads -y
dnf install quads-lib


Documentation
=============
Expand Down
10 changes: 8 additions & 2 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,21 @@ def main():
# This uses sys.executable the same way that the call in
# cookiecutter-pylibrary/hooks/post_gen_project.py
# invokes this bootstrap.py itself.
for line in subprocess.check_output([sys.executable, "-m", "tox", "--listenvs"], universal_newlines=True).splitlines()
for line in subprocess.check_output(
[sys.executable, "-m", "tox", "--listenvs"], universal_newlines=True
).splitlines()
]
tox_environments = [line for line in tox_environments if line.startswith("py")]
for template in templates_path.rglob("*"):
if template.is_file():
template_path = template.relative_to(templates_path).as_posix()
destination = base_path / template_path
destination.parent.mkdir(parents=True, exist_ok=True)
destination.write_text(jinja.get_template(template_path).render(tox_environments=tox_environments))
destination.write_text(
jinja.get_template(template_path).render(
tox_environments=tox_environments
)
)
print(f"Wrote {template_path}")
print("DONE.")

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ ignore = [
"E501", # pycodestyle line-too-long
"S105", # Possible hardcoded password
"S106", # Hardcoded password
"COM812", # conflicts with black
"ISC001", # conflicts with black
]
select = [
"B", # flake8-bugbear
Expand Down
3 changes: 2 additions & 1 deletion src/quads_lib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ def __exit__(self, exc_type, exc_value, traceback):
self.session.close()

def _make_request(self, method: str, endpoint: str, data: Optional[dict] = None) -> dict:
full_url = urljoin(self.base_url, endpoint)
_response = self.session.request(
method,
urljoin(self.base_url, endpoint),
full_url,
json=data,
verify=self.verify,
)
Expand Down
3 changes: 2 additions & 1 deletion src/quads_lib/quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def remove_host(self, hostname: str) -> dict:
def is_available(self, hostname: str, data: dict) -> bool:
url_params = urlencode(data)
endpoint = Path("available") / hostname
json_response = self.get(f"{endpoint}?{url_params}")
full_url = f"{endpoint}?{url_params}"
json_response = self.get(full_url)
# Server returns {hostname: "True"} or {hostname: "False"}
return json_response.get(hostname) == "True"

Expand Down
Loading
Loading