pyproject fix: move all to subdir, repair toml

This commit is contained in:
Louis Abel 2023-07-02 01:56:24 -07:00
parent 89457de4d4
commit e1621cd7a0
Signed by: label
GPG Key ID: 3331F061D1D9990E
21 changed files with 63 additions and 7 deletions

View File

@ -132,6 +132,9 @@ class Import:
class SrpmImport(Import): class SrpmImport(Import):
""" """
Import class for importing rpms to a git service Import class for importing rpms to a git service
Note that this imports *as is*. This means you cannot control which branch
nor the release tag that shows up.
""" """
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
def __init__( def __init__(
@ -140,6 +143,7 @@ class SrpmImport(Import):
srpm_path: str, srpm_path: str,
release: str = '', release: str = '',
branch: str = '', branch: str = '',
distprefix: str = 'el',
git_user: str = 'git', git_user: str = 'git',
org: str = 'rpms', org: str = 'rpms',
verify_signature: bool = False verify_signature: bool = False
@ -155,6 +159,7 @@ class SrpmImport(Import):
self.__srpm_metadata = self.get_srpm_metadata(srpm_path, self.__srpm_metadata = self.get_srpm_metadata(srpm_path,
verify_signature) verify_signature)
self.__release = release self.__release = release
self.__dist_prefix = distprefix
pkg_name = self.__srpm_metadata['name'] pkg_name = self.__srpm_metadata['name']
git_url = f'ssh://{git_user}@{git_url_path}/{org}/{pkg_name}.git' git_url = f'ssh://{git_user}@{git_url_path}/{org}/{pkg_name}.git'
@ -175,7 +180,7 @@ class SrpmImport(Import):
""" """
Gets the release version from the srpm Gets the release version from the srpm
""" """
regex = r'.el(\d+)' regex = fr'.{self.distprefix}(\d+)'
dist_tag = self.__srpm_metadata['release'] dist_tag = self.__srpm_metadata['release']
regex_search = re.search(regex, dist_tag) regex_search = re.search(regex, dist_tag)
if regex_search: if regex_search:
@ -335,7 +340,54 @@ class SrpmImport(Import):
new_name = self.__srpm_metadata['name'].replace('+', 'plus') new_name = self.__srpm_metadata['name'].replace('+', 'plus')
return new_name return new_name
@property
def distprefix(self):
"""
Returns the distprefix value
"""
return self.__dist_prefix
class GitImport(Import): class GitImport(Import):
""" """
Import class for importing from git (e.g. pagure or gitlab) Import class for importing from git (e.g. pagure or gitlab)
This attempts to look at a git repo that was cloned and check for either a
metadata file or a sources file. After that, it will make a best effort
guess on how to convert it and push it to your git forge with an expected
format.
""" """
# pylint: disable=too-many-arguments
def __init__(
self,
package: str,
source_git_url_path: str,
source_git_org_path: str,
git_url_path: str,
release: str,
branch: str,
distprefix: str = 'el',
git_user: str = 'git',
org: str = 'rpms',
verify_signature: bool = False
):
"""
Init the class.
Set the org to something else if needed. Note that if you are using
subgroups, do not start with a leading slash (e.g. some_group/rpms)
"""
self.__rpm = package
self.__release = release
source_git_url = f'https://{source_git_url_path}/{source_git_org_path}/{package}.git'
git_url = f'ssh://{git_user}@{git_url_path}/{org}/{package}.git'
self.__git_url = git_url
self.__dist_prefix = distprefix
self.__dist_tag = f'.{distprefix}{release}'
self.__branch = branch
@property
def rpm_name(self):
"""
Returns the name of the RPM we're working with
"""
return self.__rpm

View File

@ -1,18 +1,16 @@
[project] [project]
name = "pv2" name = "pv2"
version = "0.9.1" version = "0.9.1"
description = "PV2 backend framework module"
readme = "README.md"
authors = [ authors = [
"Louis Abel <label@rockylinux.org>" { name = "Louis Abel", email = "label@rockylinux.org" }
] ]
maintainers = [ maintainers = [
"Louis Abel <label@rockylinux.org>" { name = "Louis Abel", email = "label@rockylinux.org" }
] ]
description = "PV2 backend framework module"
readme = "README.md"
license = "MIT"
requires-python = ">=3.6" requires-python = ">=3.6"
dependencies = [ dependencies = [
@ -25,3 +23,9 @@ dependencies = [
[project.urls] [project.urls]
"Homepage" = "https://github.com/peridotbuild/pv2" "Homepage" = "https://github.com/peridotbuild/pv2"
"Bug Tracker" = "https://github.com/peridotbuild/pv2/issues" "Bug Tracker" = "https://github.com/peridotbuild/pv2/issues"
[project.license]
file = "LICENSE"
[tool.setuptools]
package-dir = { "pv2" = "pv2" }