Skip to content

Commit b49dcf3

Browse files
committed
refactor(common): change common lib into mixed rust / py package
1 parent c82a161 commit b49dcf3

File tree

33 files changed

+534
-46
lines changed

33 files changed

+534
-46
lines changed

Cargo.lock

Lines changed: 326 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
[workspace]
22
resolver = "3"
3-
members = ["packages/debmagic"]
3+
members = ["packages/debmagic", "packages/debmagic-common"]
44

55
[workspace.package]
66
edition = "2024"
77
rust-version = "1.89"
8+
9+
[workspace.dependencies]
10+
clap = { version = ">=4.5.23", features = ["derive"] }
11+
anyhow = { version = ">=1.0.95" }
12+
config = { version = ">=0.15.9", features = ["toml"] }
13+
dirs = ">=5.0.0"
14+
# thiserror = "2.0.17" # for future uses when we need clearer error handling
15+
glob = ">=0.3.2"
16+
libc = ">=0.2.169"
17+
serde = { version = ">=1.0.217", features = ["derive"] }
18+
serde_json = ">=1.0.139"
19+
uuid = { version = ">=1.10.0", features = ["v4"] }
20+
chrono = { version = ">=0.4.42" }
21+
regex = { version = ">=1.12.2" }
22+
23+
# dev dependencies
24+
pyo3 = { version = ">=0.27.2" }
25+
test-case = { version = ">=3.3.1" }

debian/control

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ Build-Depends:
2020
librust-libc-dev (>=0.2.169),
2121
librust-serde-dev (>=1.0.217),
2222
librust-serde-json-dev (>=1.0.139),
23-
librust-uuid-dev (>=1.10.0)
23+
librust-uuid-dev (>=1.10.0),
24+
librust-chrono-dev (>=0.4.42),
25+
librust-regex-dev (>=1.12.2),
26+
librust-test-case-dev (>=3.3.1),
27+
librust-pyo3-dev (>=0.27.2)
2428
Rules-Requires-Root: no
2529
X-Style: black
2630
Standards-Version: 4.7.2

debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from pathlib import Path
88
packages_root = Path(__file__).parent.parent / "packages"
99
sys.path.extend(
1010
[
11-
str(packages_root / "debmagic-common" / "src"),
11+
str(packages_root / "debmagic-common" / "python"),
1212
str(packages_root / "debmagic-pkg" / "src"),
1313
]
1414
)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "debmagic-common"
3+
version = "0.0.1-alpha1"
4+
documentation = "https://debmagic.readthedocs.org"
5+
homepage = "https://github.com/SFTtech/debmagic"
6+
repository = "https://github.com/SFTtech/debmagic.git"
7+
edition.workspace = true
8+
rust-version.workspace = true
9+
10+
[dependencies]
11+
chrono = { workspace = true }
12+
regex = { workspace = true }
13+
pyo3 = { workspace = true }
14+
15+
[dev-dependencies]
16+
test-case = { workspace = true }
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1+
[build-system]
2+
requires = ['maturin>=1.9.4,<2']
3+
build-backend = 'maturin'
4+
15
[project]
26
name = "debmagic-common"
3-
version = "0.0.1-alpha.1"
4-
description = "utility library for common debmagic code"
5-
license = "GPL-2.0-or-later"
6-
# license-files = ["../../LICENSE"]
7-
# readme = "../../README.md"
7+
dynamic = [
8+
"version",
9+
"description",
10+
"readme",
11+
"urls",
12+
"authors",
13+
"license",
14+
"keywords",
15+
]
816
requires-python = ">=3.12"
917
classifiers = ["Programming Language :: Python :: 3"]
1018
dependencies = ["python-debian>=1.0"]
1119

12-
[project.urls]
13-
homepage = "https://github.com/SFTtech/debmagic"
14-
source = "https://github.com/SFTtech/debmagic.git"
15-
issues = "https://github.com/SFTtech/debmagic/issues"
16-
releasenotes = "https://github.com/SFTtech/debmagic/-/blob/main/debian/changelog"
17-
18-
[build-system]
19-
requires = ["setuptools>=77.0.0", "setuptools-scm"]
20-
build-backend = "setuptools.build_meta"
20+
[tool.maturin]
21+
manifest-path = "Cargo.toml"
22+
module-name = "debmagic_common._debmagic_common"
23+
python-source = "python"
24+
strip = true
25+
exclude = []
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# export all definitions from the rust submodule - TODO once we have some of those
2+
# from debmagic_common._debmagic_common import *

packages/debmagic-common/src/debmagic/common/errors.py renamed to packages/debmagic-common/python/debmagic_common/errors.py

File renamed without changes.

packages/debmagic-common/src/debmagic/common/__init__.py renamed to packages/debmagic-common/python/debmagic_common/models/__init__.py

File renamed without changes.

packages/debmagic-common/src/debmagic/common/models/changelog.py renamed to packages/debmagic-common/python/debmagic_common/models/changelog.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from ..errors import DebmagicError
99
from ..type_utils import IterableDataSource
10-
from .package_version import PackageVersion
1110

1211

1312
class ChangelogFormatError(DebmagicError):
@@ -42,7 +41,7 @@ class ChangelogMetadata:
4241
@dataclass
4342
class ChangelogEntry:
4443
package: str | None
45-
version: PackageVersion
44+
version: str
4645
distributions: list[str]
4746
metadata: ChangelogMetadata
4847
changes: list[str]

0 commit comments

Comments
 (0)