Skip to content

Commit

Permalink
Fix specfile build
Browse files Browse the repository at this point in the history
  • Loading branch information
r0x0d committed Dec 10, 2024
1 parent a4cb600 commit 1d7a536
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
1 change: 0 additions & 1 deletion command_line_assistant/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
except ImportError:
import tomli as tomllib # pyright: ignore[reportMissingImports]


CONFIG_DEFAULT_PATH: Path = Path(
"~/.config/command-line-assistant/config.toml"
).expanduser()
Expand Down
23 changes: 12 additions & 11 deletions packaging/command-line-assistant.spec
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
%global python_package_src command_line_assistant
%global binary_name c

Name: command-line-assistant
Version: 0.1.0
Release: 1%{?dist}
Expand All @@ -11,37 +14,35 @@ BuildArch: noarch

BuildRequires: python3-devel
BuildRequires: python3-setuptools
# Not needed after RHEL 10 as it is native in Python 3.11+
%if 0%{?rhel} && 0%{?rhel} < 10
BuildRequires: python3-tomli
%endif
BuildRequires: python3-wheel
BuildRequires: python3-pip

Requires: python3-requests

# Not needed after RHEL 10 as it is native in Python 3.11+
%if 0%{?rhel} && 0%{?rhel} < 10
Requires: python3-tomli
BuildRequires: python3-tomli
Requires: python3-tomli
%endif

%global python_package_src command_line_assistant
%global binary_name c

%description
A simple wrapper to interact with RAG

%prep
%autosetup -n %{name}-%{version}

%build
%py3_build
%py3_build_wheel

%install
%py3_install
%py3_install_wheel %{python_package_src}-%{version}-py3-none-any.whl

%files
%doc README.md
%license LICENSE
%{python3_sitelib}/%{python_package_src}/
%{python3_sitelib}/%{python_package_src}-*.egg-info/
%{python3_sitelib}/%{python_package_src}-%{version}.dist-info/

# Our binary is just called "c"
%{_bindir}/%{binary_name}

Expand Down
26 changes: 15 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,31 @@ requires-python = ">=3.9" # RHEL 9 and 10
readme = "README.md"
license = { file = "LICENSE" }
classifiers = ["Programming Language :: Python :: 3"]

[project.urls]
Repository = "https://github.com/rhel-lightspeed/command-line-assistant.git"
Issues = "https://github.com/rhel-lightspeed/command-line-assistant/issues"

[project.scripts]
c = "command_line_assistant.__main__:main"
urls = { Repository = "https://github.com/rhel-lightspeed/command-line-assistant.git", Issues = "https://github.com/rhel-lightspeed/command-line-assistant/issues" }
scripts = { c = "command_line_assistant.__main__:main" }

[build-system]
# pdm build is not available in rhel baseos repositories
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"


[dependency-groups]
dev = ["pytest==8.3.4", "pytest-cov==6.0.0", "pytest-randomly==3.16.0", "coverage==7.6.8", "pytest-sugar==1.0.0", "pytest-clarity==1.0.1", "tox>=4.23.2", "tox-pdm>=0.7.2"]
dev = [
"pytest==8.3.4",
"pytest-cov==6.0.0",
"pytest-randomly==3.16.0",
"coverage==7.6.8",
"pytest-sugar==1.0.0",
"pytest-clarity==1.0.1",
"tox>=4.23.2",
"tox-pdm>=0.7.2",
]

# ----- Tooling specifics

[tool.setuptools]
packages = ["command_line_assistant"]
[tool.setuptools.packages.find]
include = ["command_line_assistant*"]
namespaces = false

[tool.ruff]
# Enable ruff rules to act like flake8
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sys

from setuptools import setup
from setuptools import find_packages, setup

if sys.version_info >= (3, 11):
import tomllib
Expand All @@ -19,16 +19,24 @@
for script_name, script_path in pyproject_settings["project"]["scripts"].items():
entry_points["console_scripts"].append(f"{script_name} = {script_path}")

description = None
with open(
pyproject_settings["project"]["readme"], mode="r", encoding="utf-8"
) as handler:
description = handler.read()

setup(
name=pyproject_settings["project"]["name"],
version=pyproject_settings["project"]["version"],
author=pyproject_settings["project"]["authors"][0]["name"],
author_email=pyproject_settings["project"]["authors"][0]["email"],
description=pyproject_settings["project"]["description"],
long_description=open(pyproject_settings["project"]["readme"]).read(),
long_description=description,
long_description_content_type="text/markdown",
url=pyproject_settings["project"]["urls"]["Repository"],
packages=pyproject_settings["tool"]["setuptools"]["packages"],
packages=find_packages(
include=pyproject_settings["tool"]["setuptools"]["packages"]["find"]["include"]
),
install_requires=pyproject_settings["project"]["dependencies"],
entry_points=entry_points,
classifiers=pyproject_settings["project"]["classifiers"],
Expand Down

0 comments on commit 1d7a536

Please sign in to comment.