2019-09-11 17:18:51 -04:00
|
|
|
#!/usr/bin/python3
|
2007-06-01 11:44:28 +02:00
|
|
|
|
2010-08-02 20:41:09 +02:00
|
|
|
import glob
|
2023-01-30 21:56:37 +01:00
|
|
|
import pathlib
|
2007-06-01 11:44:28 +02:00
|
|
|
import re
|
|
|
|
|
2023-01-30 21:28:47 +01:00
|
|
|
from setuptools import setup
|
|
|
|
|
2023-01-30 14:07:23 +01:00
|
|
|
|
2023-01-30 21:56:37 +01:00
|
|
|
def get_debian_version() -> str:
|
|
|
|
"""Look what Debian version we have."""
|
|
|
|
changelog = pathlib.Path(__file__).parent / "debian" / "changelog"
|
|
|
|
with changelog.open("r", encoding="utf-8") as changelog_f:
|
|
|
|
head = changelog_f.readline()
|
|
|
|
match = re.compile(r".*\((.*)\).*").match(head)
|
|
|
|
if not match:
|
|
|
|
raise ValueError(f"Failed to extract Debian version from '{head}'.")
|
|
|
|
return match.group(1)
|
|
|
|
|
|
|
|
|
2023-01-30 14:07:23 +01:00
|
|
|
def make_pep440_compliant(version: str) -> str:
|
|
|
|
"""Convert the version into a PEP440 compliant version."""
|
|
|
|
public_version_re = re.compile(r"^([0-9][0-9.]*(?:(?:a|b|rc|.post|.dev)[0-9]+)*)\+?")
|
|
|
|
_, public, local = public_version_re.split(version, maxsplit=1)
|
|
|
|
if not local:
|
|
|
|
return version
|
|
|
|
sanitized_local = re.sub("[+~]+", ".", local).strip(".")
|
|
|
|
pep440_version = f"{public}+{sanitized_local}"
|
|
|
|
assert re.match("^[a-zA-Z0-9.]+$", sanitized_local), f"'{pep440_version}' not PEP440 compliant"
|
|
|
|
return pep440_version
|
|
|
|
|
|
|
|
|
2019-09-04 19:21:48 -03:00
|
|
|
scripts = [
|
2023-01-30 19:45:36 +01:00
|
|
|
"backportpackage",
|
|
|
|
"bitesize",
|
|
|
|
"check-mir",
|
|
|
|
"check-symbols",
|
|
|
|
"dch-repeat",
|
|
|
|
"grab-merge",
|
|
|
|
"grep-merges",
|
|
|
|
"import-bug-from-debian",
|
|
|
|
"merge-changelog",
|
|
|
|
"mk-sbuild",
|
|
|
|
"pbuilder-dist",
|
|
|
|
"pbuilder-dist-simple",
|
2024-11-02 16:41:44 +01:00
|
|
|
"pm-helper",
|
2023-01-30 19:45:36 +01:00
|
|
|
"pull-pkg",
|
|
|
|
"pull-debian-debdiff",
|
|
|
|
"pull-debian-source",
|
|
|
|
"pull-debian-debs",
|
|
|
|
"pull-debian-ddebs",
|
|
|
|
"pull-debian-udebs",
|
|
|
|
"pull-lp-source",
|
|
|
|
"pull-lp-debs",
|
|
|
|
"pull-lp-ddebs",
|
|
|
|
"pull-lp-udebs",
|
|
|
|
"pull-ppa-source",
|
|
|
|
"pull-ppa-debs",
|
|
|
|
"pull-ppa-ddebs",
|
|
|
|
"pull-ppa-udebs",
|
|
|
|
"pull-uca-source",
|
|
|
|
"pull-uca-debs",
|
|
|
|
"pull-uca-ddebs",
|
|
|
|
"pull-uca-udebs",
|
|
|
|
"requestbackport",
|
|
|
|
"requestsync",
|
|
|
|
"reverse-depends",
|
2024-02-29 13:06:12 -08:00
|
|
|
"running-autopkgtests",
|
2023-01-30 19:45:36 +01:00
|
|
|
"seeded-in-ubuntu",
|
|
|
|
"setup-packaging-environment",
|
|
|
|
"sponsor-patch",
|
|
|
|
"submittodebian",
|
|
|
|
"syncpackage",
|
|
|
|
"ubuntu-build",
|
|
|
|
"ubuntu-iso",
|
|
|
|
"ubuntu-upload-permission",
|
|
|
|
"update-maintainer",
|
2019-09-04 19:21:48 -03:00
|
|
|
]
|
|
|
|
data_files = [
|
2023-01-30 19:45:36 +01:00
|
|
|
("share/bash-completion/completions", glob.glob("bash_completion/*")),
|
|
|
|
("share/man/man1", glob.glob("doc/*.1")),
|
|
|
|
("share/man/man5", glob.glob("doc/*.5")),
|
|
|
|
("share/ubuntu-dev-tools", ["enforced-editing-wrapper"]),
|
2019-09-04 19:21:48 -03:00
|
|
|
]
|
2010-12-22 15:05:55 +02:00
|
|
|
|
2023-01-30 19:45:36 +01:00
|
|
|
if __name__ == "__main__":
|
2017-05-01 00:20:03 +02:00
|
|
|
setup(
|
2023-01-30 19:45:36 +01:00
|
|
|
name="ubuntu-dev-tools",
|
2023-01-30 21:56:37 +01:00
|
|
|
version=make_pep440_compliant(get_debian_version()),
|
2017-05-01 00:20:03 +02:00
|
|
|
scripts=scripts,
|
|
|
|
packages=[
|
2023-01-30 19:45:36 +01:00
|
|
|
"ubuntutools",
|
|
|
|
"ubuntutools/lp",
|
|
|
|
"ubuntutools/requestsync",
|
|
|
|
"ubuntutools/sponsor_patch",
|
|
|
|
"ubuntutools/test",
|
2017-05-01 00:20:03 +02:00
|
|
|
],
|
|
|
|
data_files=data_files,
|
2023-01-30 19:45:36 +01:00
|
|
|
test_suite="ubuntutools.test",
|
2010-12-22 15:05:55 +02:00
|
|
|
)
|