cd psycopg
Please note that the repository contains the source code of several Python
-packages: that's why you don't see a ``setup.py`` here. The packages may have
-different requirements:
+packages, which may have different requirements:
- The ``psycopg`` directory contains the pure python implementation of
``psycopg``. The package has only a runtime dependency on the ``libpq``, the
versions.
- Add the ``Programming Language :: Python :: 3.<X>`` classifier to
- ``psycopg/setup.cfg``, ``psycopg_c/setup.cfg`` and ``psycopg_pool/setup.cfg``.
+ ``psycopg/pyproject.toml``, ``psycopg_c/pyproject.toml``, and
+ ``psycopg_pool/pyproject.toml``.
- Update the list of versions in ``tools/build/build_macos_arm64.sh`` to include
the new version. Look for both the ``python_versions`` variable and the
shutil.copytree(pdir / "psycopg_c", target)
shutil.move(str(target / "psycopg_c"), str(target / "psycopg_binary"))
shutil.move(str(target / "README-binary.rst"), str(target / "README.rst"))
-sed_i("psycopg-c", "psycopg-binary", target / "setup.cfg")
+sed_i("psycopg-c", "psycopg-binary", target / "pyproject.toml")
+sed_i(r'"psycopg_c([\./][^"]+)?"', r'"psycopg_binary\1"', target / "pyproject.toml")
sed_i(r"__impl__\s*=.*", '__impl__ = "binary"', target / "psycopg_binary/pq.pyx")
for dirpath, dirnames, filenames in os.walk(target):
for filename in filenames:
@dataclass
class Package:
name: str
- ini_files: list[Path]
+ toml_files: list[Path]
history_file: Path
tag_format: str
extras: list[str]
Package(
name="psycopg",
- ini_files=[
- PROJECT_DIR / "psycopg/setup.cfg",
- PROJECT_DIR / "psycopg_c/setup.cfg",
+ toml_files=[
+ PROJECT_DIR / "psycopg/pyproject.toml",
+ PROJECT_DIR / "psycopg_c/pyproject.toml",
],
history_file=PROJECT_DIR / "docs/news.rst",
tag_format="{version}",
Package(
name="psycopg_pool",
- ini_files=[PROJECT_DIR / "psycopg_pool/setup.cfg"],
+ toml_files=[PROJECT_DIR / "psycopg_pool/pyproject.toml"],
history_file=PROJECT_DIR / "docs/news_pool.rst",
tag_format="pool-{version}",
extras=[],
self._ini_regex = re.compile(
r"""(?ix)
^
- (?P<pre> version \s* = \s*)
- (?P<ver> [^\s]+)
- (?P<post> \s*)
+ (?P<pre> version \s* = \s* ")
+ (?P<ver> [^\s"]+)
+ (?P<post> " \s*)
\s* $
"""
)
self._extra_regex = re.compile(
r"""(?ix)
^
- (?P<pre> \s* )
+ (?P<pre> \s* ")
(?P<package> [^\s]+)
(?P<op> \s* == \s*)
(?P<ver> [^\s]+)
@cached_property
def current_version(self) -> Version:
- versions = {self._parse_version_from_file(f) for f in self.package.ini_files}
+ versions = {self._parse_version_from_file(f) for f in self.package.toml_files}
if len(versions) > 1:
raise ValueError(
f"inconsistent versions ({', '.join(map(str, sorted(versions)))})"
- f" in {self.package.ini_files}"
+ f" in {self.package.toml_files}"
)
return versions.pop()
return Version(".".join(sparts))
def update_files(self) -> None:
- for f in self.package.ini_files:
+ for f in self.package.toml_files:
self._update_version_in_file(f, self.want_version)
if self.bump_level != BumpLevel.DEV:
msg = f"""\
chore: bump {self.package.name} package version to {self.want_version}
"""
- files = self.package.ini_files + [self.package.history_file]
+ files = self.package.toml_files + [self.package.history_file]
cmdline = ["git", "commit", "-m", msg] + list(map(str, files))
sp.check_call(cmdline)