Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-argparse-manpage for 
openSUSE:Factory checked in at 2023-06-15 11:45:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-argparse-manpage (Old)
 and      /work/SRC/openSUSE:Factory/.python-argparse-manpage.new.15902 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-argparse-manpage"

Thu Jun 15 11:45:24 2023 rev:13 rq:1093250 version:4.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-argparse-manpage/python-argparse-manpage.changes
  2023-04-16 19:39:06.902379434 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-argparse-manpage.new.15902/python-argparse-manpage.changes
       2023-06-15 11:45:25.201404734 +0200
@@ -1,0 +2,11 @@
+Thu Jun 15 09:42:01 UTC 2023 - Steve Kowalik <[email protected]>
+
+- Update to 4.3:
+  * The pyproject.toml parsing feature now depends on tomli
+  * Support for pyproject.toml specification of manpages added.
+  * Support for pre-written man pages (the --manfile option)
+  * Incorrect dict access for --include support fixed.
+- Add patch skip-pip-install.patch:
+  * Skip pip install tests for now.
+
+-------------------------------------------------------------------

Old:
----
  v4.1.tar.gz

New:
----
  skip-pip-install.patch
  v4.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-argparse-manpage.spec ++++++
--- /var/tmp/diff_new_pack.Dog7lu/_old  2023-06-15 11:45:26.029409657 +0200
+++ /var/tmp/diff_new_pack.Dog7lu/_new  2023-06-15 11:45:26.033409681 +0200
@@ -17,22 +17,24 @@
 
 
 %define mod_name argparse-manpage
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-argparse-manpage
-Version:        4.1
+Version:        4.3
 Release:        0
 Summary:        Tool for automatic manual page building from a Python 
ArgumentParser object
 License:        Apache-2.0
-Group:          Development/Languages/Python
 URL:            https://github.com/praiskup/argparse-manpage
 Source:         
https://github.com/praiskup/argparse-manpage/archive/v%{version}.tar.gz
+# PATCH-FIX-OPENSUSE Skip pip install tests until pip can behave better
+Patch0:         skip-pip-install.patch
 BuildArch:      noarch
 BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  ca-certificates
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-setuptools
+Requires:       python-tomli
 Requires(post): update-alternatives
 Requires(postun):update-alternatives
 %python_subpackages
@@ -47,7 +49,7 @@
 support for (deprecated) optparse objects, too.
 
 %prep
-%setup -q -n %{mod_name}-%{version}
+%autosetup -p1 -n %{mod_name}-%{version}
 
 %build
 %python_build
@@ -70,7 +72,9 @@
 %files %{python_files}
 %doc README*
 %license LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/argparse_manpage
+%{python_sitelib}/build_manpages
+%{python_sitelib}/argparse_manpage-%{version}*info
 %python_alternative %{_bindir}/argparse-manpage
 %python_alternative %{_mandir}/man1/argparse-manpage.1%{?ext_man}
 

++++++ skip-pip-install.patch ++++++
Index: argparse-manpage-4.3/tests/test_examples.py
===================================================================
--- argparse-manpage-4.3.orig/tests/test_examples.py
+++ argparse-manpage-4.3/tests/test_examples.py
@@ -38,6 +38,8 @@ def _rmtree(directory):
             raise
 
 def run_pip(args):
+    # Until we can figure out how to make pip behave
+    raise unittest.SkipTest()
     environ = os.environ.copy()
     environ['PYTHONPATH'] = ':'.join(sys.path)
     from pip import __version__

++++++ v4.1.tar.gz -> v4.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/MANIFEST.in 
new/argparse-manpage-4.3/MANIFEST.in
--- old/argparse-manpage-4.1/MANIFEST.in        2023-04-15 21:12:23.000000000 
+0200
+++ new/argparse-manpage-4.3/MANIFEST.in        2023-05-17 15:02:31.000000000 
+0200
@@ -10,6 +10,7 @@
 include examples/resalloc/expected/man/resalloc.1
 include examples/copr/fake-deps/HACK
 include examples/copr/fake-deps/copr/README
+include examples/pre-written-man-page/psutils.1
 include examples/raw-description/bin/dg
 include examples/resalloc/bin/resalloc
 include examples/resalloc/bin/resalloc-maint
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/NEWS 
new/argparse-manpage-4.3/NEWS
--- old/argparse-manpage-4.1/NEWS       2023-04-15 21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/NEWS       2023-05-17 15:02:31.000000000 +0200
@@ -5,6 +5,29 @@
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+News in v4.3
+
+* The pyproject.toml parsing feature now depends on the python3-tomli library
+  instead of python-toml for "python_environment >3, <=3.10".
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+News in v4.2
+
+* Support for pyproject.toml specification of manpages added.
+
+* Support for pre-written man pages (the --manfile option)
+
+Bugfixes in version 4.2
+
+* Incorrect dict access for --include support fixed.
+
+* Provide useful AUTHORS section with e-mail from
+  Distribution.get_author_email() even if Distribution.get_author() returns
+  None.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 News in v4.1
 
 * A new `--include` feature, inspired by `help2man --include`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/README.md 
new/argparse-manpage-4.3/README.md
--- old/argparse-manpage-4.1/README.md  2023-04-15 21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/README.md  2023-05-17 15:02:31.000000000 +0200
@@ -84,7 +84,7 @@
 )
 ```
 
-And in the `setup.cfg` configure the manual pages you want to automatically
+And in `setup.cfg` configure the manual pages you want to automatically
 generate and install:
 
 ```
@@ -95,6 +95,17 @@
     man/baz.1:function=get_parser:pyfile=bin/bar:prog=baz
 ```
 
+Or in `pyproject.toml` (requires setuptools >= 62.2.0):
+
+```toml
+[build_manpages]
+manpages = [
+    "man/foo.1:object=parser:pyfile=bin/foo.py",
+    "man/bar.1:function=get_parser:pyfile=bin/bar",
+    "man/baz.1:function=get_parser:pyfile=bin/bar:prog=baz",
+]
+```
+
 The format of those lines is a colon separated list of arguments/options.  The
 first argument determines the filename of the generated manual page.  Then
 follows a list of options of format `option=value`.  Supported values are:
@@ -115,8 +126,10 @@
 - manual_title - the title of the manual, by default "Generated Python Manual",
     see man (7) man-pages for more instructions
 - include - a file of extra material to include; see below for the format
+- manfile - a file containing a complete man page that just needs to be 
installed
 
-The values from setup.cfg override values from setup.py's setup().
+The values from setup.cfg override values from setup.py's setup(). Note that
+when `manfile` is set for a particular page, no other option is allowed.
 
 Then run `setup.py build_manpages` to build a manpages for your project.  Also,
 if you used `get_build_py` helper, `setup.py build` then transitively builds 
the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/argparse_manpage/__init__.py 
new/argparse-manpage-4.3/argparse_manpage/__init__.py
--- old/argparse-manpage-4.1/argparse_manpage/__init__.py       2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/argparse_manpage/__init__.py       2023-05-17 
15:02:31.000000000 +0200
@@ -2,4 +2,4 @@
 argparse_manpage project
 """
 
-__version__ = '4.1'
+__version__ = '4.3'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/argparse_manpage/cli.py 
new/argparse-manpage-4.3/argparse_manpage/cli.py
--- old/argparse-manpage-4.1/argparse_manpage/cli.py    2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/argparse_manpage/cli.py    2023-05-17 
15:02:31.000000000 +0200
@@ -68,6 +68,8 @@
     "See man (7) man-pages for more instructions."))
 ap.add_argument("--include", metavar="FILE", help=(
     "File that contains extra material for the man page."))
+ap.add_argument("--manfile", metavar="FILE", help=(
+    "File containing a complete man page."))
 
 
 def args_to_manpage_data(args):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/argparse_manpage/compat.py 
new/argparse-manpage-4.3/argparse_manpage/compat.py
--- old/argparse-manpage-4.1/argparse_manpage/compat.py 2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/argparse_manpage/compat.py 2023-05-17 
15:02:31.000000000 +0200
@@ -7,9 +7,9 @@
 # Drop once Python 2.7 is dropped
 # pylint: disable=unused-import
 try:
-    from configparser import ConfigParser
+    from configparser import ConfigParser, NoSectionError
 except ImportError:
-    from ConfigParser import SafeConfigParser as ConfigParser  # type: ignore
+    from ConfigParser import SafeConfigParser as ConfigParser, NoSectionError  
# type: ignore
 
 if sys.version_info < (3, 0):
     import imp  # pylint: disable=deprecated-module
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/argparse_manpage/manpage.py 
new/argparse-manpage-4.3/argparse_manpage/manpage.py
--- old/argparse-manpage-4.1/argparse_manpage/manpage.py        2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/argparse_manpage/manpage.py        2023-05-17 
15:02:31.000000000 +0200
@@ -43,6 +43,7 @@
     "manual_section",
     "manual_title",
     "include",
+    "manfile",
 )
 
 # manpage sections that are handled specially, so need special treatment
@@ -71,10 +72,15 @@
     """
     # authors
     if not "authors" in data:
-        author = distribution.get_author()
-        if distribution.get_author_email():
-            author += " <{}>".format(distribution.get_author_email())
-        data["authors"] = [author]
+        author = None
+        if distribution.get_author():
+            author = distribution.get_author()
+            if distribution.get_author_email():
+                author += " <{}>".format(distribution.get_author_email())
+        elif distribution.get_author_email():
+            author = distribution.get_author_email()
+        if author:
+            data["authors"] = [author]
 
     attrs = list(MANPAGE_DATA_ATTRS)
     attrs.remove("authors")
@@ -155,6 +161,12 @@
         if not getattr(parser, '_manpage', None):
             self.parser._manpage = []
 
+        self.manfile = self._data.get("manfile")
+        if self.manfile:
+            if len(self._data) > 1:
+                raise ValueError("manfile set, so no other key is allowed")
+            return
+
         self.formatter = self.parser._get_formatter()
         self.mf = _ManpageFormatter(self.prog, self.formatter, 
format=self.format)
         self.synopsis = self.parser.format_usage().split(':')[-1].split()
@@ -193,6 +205,10 @@
         return 
self.mf.format_text(self.formatter._format_text(text)).strip('\n')
 
     def __str__(self):
+        if self.manfile:
+            with open(self.manfile) as fd:
+                return fd.read()
+
         lines = []
 
         # Header
@@ -226,7 +242,7 @@
         if self.synopsis or synopsis_section:
             lines.append('.SH SYNOPSIS')
             if synopsis_section:
-                lines.append(synopsis_section.content)
+                lines.append(synopsis_section["content"])
             else:
                 lines.append('.B {}'.format(_markup(self.synopsis[0])))
                 lines.append(' '.join(self.synopsis[1:]))
@@ -234,7 +250,7 @@
         extra_description = None
         description_section = self.get_extra_section("description")
         if description_section:
-            extra_description = description_section.content
+            extra_description = description_section["content"]
         lines.extend(self.mf.format_parser(self.parser, 
extra_description=extra_description))
 
         comments_section = self.get_extra_section("comments")
@@ -242,7 +258,7 @@
             lines.append("")
             lines.append('.SH COMMENTS')
             if comments_section:
-                lines.append(comments_section.content)
+                lines.append(comments_section["content"])
             else:
                 lines.append(self.format_text(self.parser.epilog))
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/argparse-manpage-4.1/build_manpages/build_manpages.py 
new/argparse-manpage-4.3/build_manpages/build_manpages.py
--- old/argparse-manpage-4.1/build_manpages/build_manpages.py   2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/build_manpages/build_manpages.py   2023-05-17 
15:02:31.000000000 +0200
@@ -6,7 +6,18 @@
 import os
 import shutil
 
-from argparse_manpage.compat import ConfigParser
+try:
+    import tomllib
+    from tomllib import TOMLDecodeError
+except ImportError:
+    try:
+        import tomli as tomllib
+        from tomli import TOMLDecodeError
+    except ImportError:
+        import toml as tomllib
+        from toml import TomlDecodeError as TOMLDecodeError
+
+from argparse_manpage.compat import ConfigParser, NoSectionError
 from argparse_manpage.tooling import get_parser, write_to_filename
 from argparse_manpage.manpage import (
     Manpage,
@@ -66,6 +77,21 @@
 
     return manpages_data
 
+def get_pyproject_settings():
+    """Parse and handle errors of a toml configuration file."""
+    try:
+        with open("pyproject.toml", mode="r") as fp:
+            content = tomllib.loads(fp.read())
+    except TOMLDecodeError:
+        return None
+
+    try:
+        value = content["tool"][DEFAULT_CMD_NAME]["manpages"]
+        if isinstance(value, list):
+            value = "\n".join(value)
+        return str(value)
+    except KeyError:
+        return None
 
 class build_manpages(Command):
     description = 'Generate set of man pages from setup().'
@@ -78,10 +104,10 @@
 
 
     def finalize_options(self):
-        if not self.manpages:
+        manpages = self.manpages or get_pyproject_settings()
+        if not manpages:
             raise DistutilsOptionError('\'manpages\' option is required')
-
-        self.manpages_data = parse_manpages_spec(self.manpages)
+        self.manpages_data = parse_manpages_spec(manpages)
 
         # if a value wasn't set in setup.cfg, use the value from setup.py
         for page, data in self.manpages_data.items():
@@ -89,6 +115,9 @@
 
     def run(self):
         for page, data in self.manpages_data.items():
+            if data.get('manfile'):
+                print ("using pre-written " + page)
+                return
             print ("generating " + page)
             parser = get_parser(data['import_type'], data['import_from'], 
data['objname'], data['objtype'], data.get('prog', None))
             format = data.get('format', 'pretty')
@@ -135,7 +164,13 @@
             """
             config = ConfigParser()
             config.read('setup.cfg')
-            spec = config.get(DEFAULT_CMD_NAME, 'manpages')
+            try:
+                spec = config.get(DEFAULT_CMD_NAME, 'manpages')
+            except NoSectionError:
+                spec = get_pyproject_settings()
+            if spec is None:
+                raise ValueError("'manpage' configuration not found in 
setup.cfg or pyproject.toml")
+
             data = parse_manpages_spec(spec)
 
             mandir = os.path.join(self.install_data, 'share/man/man1')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/argparse-manpage-4.1/examples/pre-written-man-page/psutils.1 
new/argparse-manpage-4.3/examples/pre-written-man-page/psutils.1
--- old/argparse-manpage-4.1/examples/pre-written-man-page/psutils.1    
1970-01-01 01:00:00.000000000 +0100
+++ new/argparse-manpage-4.3/examples/pre-written-man-page/psutils.1    
2023-05-17 15:02:31.000000000 +0200
@@ -0,0 +1,41 @@
+.TH PSUTILS 1 "PSUtils"
+.SH NAME
+PSUtils \- PostScript utilities
+.SH DESCRIPTION
+PSUtils is a set of utilities for manipulating PostScript
+documents which follow the Adobe Document Structuring Conventions.
+.SH UNITS OF LENGTH
+PSUtils utilities accept lengths in various units:
+.IP \(bu
+.B pt
+(PostScript points, 72 points per inch)
+.IP \(bu
+.B mm
+(millimetres)
+.IP \(bu
+.B cm
+(centimetres)
+.IP \(bu
+.B in
+(inches, 1 inch is 25.4mm)
+.PP
+Write the length as a number directly followed by the unit, for example,
+.B 4.5mm
+or
+.BR 72pt .
+If no unit is given, PostScript points are assumed.
+.SH AUTHOR
+Written by Angus J. C. Duggan.
+.SH "SEE ALSO"
+.BR psbook (1),
+.BR psselect (1),
+.BR pstops (1),
+.BR epsffit (1),
+.BR psnup (1),
+.BR psresize (1),
+.BR psjoin (1),
+.BR extractres (1),
+.BR includeres (1)
+.SH TRADEMARKS
+.B PostScript
+is a trademark of Adobe Systems Incorporated.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/argparse-manpage-4.1/examples/pre-written-man-page/setup.cfg 
new/argparse-manpage-4.3/examples/pre-written-man-page/setup.cfg
--- old/argparse-manpage-4.1/examples/pre-written-man-page/setup.cfg    
1970-01-01 01:00:00.000000000 +0100
+++ new/argparse-manpage-4.3/examples/pre-written-man-page/setup.cfg    
2023-05-17 15:02:31.000000000 +0200
@@ -0,0 +1,3 @@
+[build_manpages]
+manpages =
+    psutils.1:manfile=psutils.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/argparse-manpage-4.1/examples/pre-written-man-page/setup.py 
new/argparse-manpage-4.3/examples/pre-written-man-page/setup.py
--- old/argparse-manpage-4.1/examples/pre-written-man-page/setup.py     
1970-01-01 01:00:00.000000000 +0100
+++ new/argparse-manpage-4.3/examples/pre-written-man-page/setup.py     
2023-05-17 15:02:31.000000000 +0200
@@ -0,0 +1,10 @@
+from build_manpages.build_manpages import build_manpages, get_install_cmd, 
get_build_py_cmd
+from setuptools import setup
+
+setup(
+    cmdclass={
+        'build_manpages': build_manpages,
+        'build_py': get_build_py_cmd(),
+        'install': get_install_cmd(),
+    }
+)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/pyproject.toml 
new/argparse-manpage-4.3/pyproject.toml
--- old/argparse-manpage-4.1/pyproject.toml     1970-01-01 01:00:00.000000000 
+0100
+++ new/argparse-manpage-4.3/pyproject.toml     2023-05-17 15:02:31.000000000 
+0200
@@ -0,0 +1,12 @@
+[build-system]
+requires = [
+    "setuptools",
+    "tomli; python_version >= '3' and python_version < '3.11'",
+    "toml; python_version < '3'",
+    "packaging",
+]
+
+[tool.build_manpages]
+manpages = [
+    "some-file.1:pyfile=some-file:function=get_parser",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/rpm/argparse-manpage.spec.tpl 
new/argparse-manpage-4.3/rpm/argparse-manpage.spec.tpl
--- old/argparse-manpage-4.1/rpm/argparse-manpage.spec.tpl      2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/rpm/argparse-manpage.spec.tpl      2023-05-17 
15:02:31.000000000 +0200
@@ -38,6 +38,8 @@
 
 %if %{with python2}
 BuildRequires: python2-setuptools python2-devel
+BuildRequires: python2-packaging
+BuildRequires: python2-toml
 %if %{with check}
 %if 0%{?rhel} && 0%{?rhel} == 7
 BuildRequires: pytest
@@ -49,6 +51,8 @@
 
 %if %{with python3}
 BuildRequires: python3-setuptools python3-devel
+BuildRequires: python3-packaging
+BuildRequires: python3-tomli
 %if %{with check}
 BuildRequires: python3-pytest
 %endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/setup.py 
new/argparse-manpage-4.3/setup.py
--- old/argparse-manpage-4.1/setup.py   2023-04-15 21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/setup.py   2023-05-17 15:02:31.000000000 +0200
@@ -21,6 +21,11 @@
     with open(os.path.join(ROOT_DIR, 'README.md')) as fh:
         return ''.join(fh.readlines())
 
+if sys.version_info >= (3,):
+    install_requires = ['tomli;python_version<"3.11"']
+else:
+    install_requires = ['toml']
+
 setup(
     name='argparse-manpage',
     version=__version__,
@@ -44,6 +49,7 @@
         'build_py': get_build_py_cmd(),
         'install': get_install_cmd(),
     },
+    install_requires=install_requires,
     extras_require={
         'setuptools': ["setuptools"]
     },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/test-requirements.txt 
new/argparse-manpage-4.3/test-requirements.txt
--- old/argparse-manpage-4.1/test-requirements.txt      2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/test-requirements.txt      1970-01-01 
01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-pytest
-setuptools
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/tests/argparse_testlib.py 
new/argparse-manpage-4.3/tests/argparse_testlib.py
--- old/argparse-manpage-4.1/tests/argparse_testlib.py  2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/tests/argparse_testlib.py  2023-05-17 
15:02:31.000000000 +0200
@@ -2,8 +2,10 @@
 unit-tests helpers
 """
 
+import os
 from platform import python_version
 from pkg_resources import parse_version
+from contextlib import contextmanager
 
 import pytest
 
@@ -22,3 +24,12 @@
             python_version(),
         )
         raise pytest.skip("{0} ({1})".format(message, generic_msg))
+
+@contextmanager
+def pushd(path):
+    old_dir = os.getcwd()
+    os.chdir(path)
+    try:
+        yield
+    finally:
+        os.chdir(old_dir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/tests/test_examples.py 
new/argparse-manpage-4.3/tests/test_examples.py
--- old/argparse-manpage-4.1/tests/test_examples.py     2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/tests/test_examples.py     2023-05-17 
15:02:31.000000000 +0200
@@ -12,7 +12,7 @@
 
 sys.path = 
[os.path.join(os.path.dirname(os.path.realpath(__file__)),'..')]+sys.path
 
-from argparse_testlib import skip_on_python_older_than
+from argparse_testlib import skip_on_python_older_than, pushd
 
 
 def _mandir(prefix, num=1):
@@ -21,15 +21,6 @@
 
 
 @contextmanager
-def pushd(path):
-    old_dir = os.getcwd()
-    os.chdir(path)
-    try:
-        yield
-    finally:
-        os.chdir(old_dir)
-
-@contextmanager
 def change_argv(argv):
     old_argv = sys.argv
     sys.argv = argv
@@ -64,14 +55,8 @@
     environ = os.environ.copy()
     environ['PYTHONPATH'] = ':'.join(sys.path)
     with change_argv(['setup.py'] + args):
-        subprocess.call([sys.executable, 'setup.py'] + args,
-                        env=environ)
-
-def skip_if_older_python(min_version):
-    def _get_int(version):
-        int_v = [int(sv) for sv in version.split(".")]
-
-
+        return subprocess.call([sys.executable, 'setup.py'] + args,
+                               env=environ)
 
 
 def run_one_installer(installer, args):
@@ -112,7 +97,7 @@
                 assert left == right
 
 
-class TestAllExapmles:
+class TestAllExamples:
     def test_old_example(self):
         with pushd('examples/old_format'):
             try:
@@ -206,6 +191,18 @@
             file_cmp(os.path.join(mandir, os.path.basename(name)), 
'expected-output.1')
             file_cmp(name, 'expected-output.1')
 
+    @pytest.mark.parametrize("installer", ["pip", "setuppy"])
+    def test_pre_written_man_page(self, installer):
+        with pushd('examples/pre-written-man-page'):
+            name = 'psutils.1'
+            prefix = '/usr'
+            idir = os.path.join(os.getcwd(), installer + "_install_dir")
+            mandir = os.path.join(idir, _mandir("usr/"))
+            _rmtree(idir)
+            run_one_installer(installer, ['install', '--root', idir, 
'--prefix', prefix])
+
+            file_cmp(os.path.join(mandir, name), name)
+
 
 if __name__ == "__main__":
     unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/tests/test_script.py 
new/argparse-manpage-4.3/tests/test_script.py
--- old/argparse-manpage-4.1/tests/test_script.py       2023-04-15 
21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/tests/test_script.py       2023-05-17 
15:02:31.000000000 +0200
@@ -9,8 +9,16 @@
 import subprocess
 import tempfile
 import time
+import warnings
 
-SIMPLE_FILE_CONTENTS = """
+from packaging import version
+
+import setuptools
+
+from test_examples import run_setup_py
+from argparse_testlib import pushd
+
+SIMPLE_FILE_CONTENTS = """\
 import argparse
 
 def get_parser():
@@ -18,13 +26,16 @@
         parser.add_argument("test")
         return parser
 
-if __name__ == "__main__":
+def main():
         print("here")
         get_parser().parse_args()
+
+if __name__ == "__main__":
+        main()
 """
 
 SIMPLE_OUTPUT = """\
-.TH {NAME} "1" "{DATE}" "{name}" "Generated Python Manual"
+.TH {NAME} "1" "{DATE}" "{name}{version}" "Generated Python Manual"
 .SH NAME
 {name}
 .SH SYNOPSIS
@@ -58,6 +69,26 @@
 .fi
 """
 
+SETUP_PY_FILE_CONTENTS = """\
+from build_manpages import build_manpages, get_install_cmd, get_build_py_cmd
+from setuptools import setup
+
+setup(
+    cmdclass={
+        'build_manpages': build_manpages,
+        'build_py': get_build_py_cmd(),
+        'install': get_install_cmd(),
+    }
+)
+"""
+
+PYPROJECT_TOML_FILE_CONTENTS = """\
+[tool.build_manpages]
+manpages = [
+    "some-file.1:project_name=some-file:module=somefile:function=get_parser",
+]
+"""
+
 DATE = datetime.datetime.utcfromtimestamp(
            int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
        ).strftime("%Y\\-%m\\-%d")
@@ -66,6 +97,7 @@
     def setup_method(self, _):
         self.workdir = tempfile.mkdtemp(prefix="argparse-manpage-tests-")
         os.environ["PYTHON"] = sys.executable
+        os.environ["PYTHONPATH"] = os.getcwd()
 
     def teardown_method(self, _):
         shutil.rmtree(self.workdir)
@@ -92,7 +124,7 @@
             "--function", "get_parser",
         ]
         output = subprocess.check_output(cmd).decode("utf-8")
-        assert output == SIMPLE_OUTPUT.format(name=expname,
+        assert output == SIMPLE_OUTPUT.format(name=expname, version="",
                                               NAME=expname.upper(), DATE=DATE)
 
     def test_filepath_prog(self):
@@ -113,7 +145,7 @@
         ]
         output = subprocess.check_output(cmd).decode("utf-8")
         name="progname"
-        assert output == SIMPLE_OUTPUT.format(name=expname,
+        assert output == SIMPLE_OUTPUT.format(name=expname, version="",
                                               NAME=expname.upper(), DATE=DATE)
 
     def test_full_args(self):
@@ -143,3 +175,29 @@
         name="progname"
         assert output == FULL_OUTPUT.format(name=name, NAME=name.upper(),
                                             DATE=DATE)
+
+    def test_pyproject_toml(self):
+        """
+        Test that we can read information from pyproject.toml.
+        """
+        current_dir = os.getcwd()
+        with pushd(self.workdir):
+            with open("pyproject.toml", "w+") as script_fd:
+                
script_fd.write(PYPROJECT_TOML_FILE_CONTENTS.format(gitdir=current_dir))
+            with open("setup.py", "w+") as script_fd:
+                script_fd.write(SETUP_PY_FILE_CONTENTS)
+
+            modname = "somefile"
+            name = r"some\-file"
+            os.mkdir(modname)
+            with open(os.path.join(modname, "__init__.py"), "w+") as script_fd:
+                script_fd.write(SIMPLE_FILE_CONTENTS.format(ap_arguments=""))
+
+            assert 0 == run_setup_py(["build"])
+            if version.parse(setuptools.__version__) >= 
version.parse("62.2.0"):
+                with open("some-file.1") as script_fd:
+                    output = script_fd.read()
+                    assert output == SIMPLE_OUTPUT.format(name=name, version=" 
0.0.0",
+                                                          NAME=name.upper(), 
DATE=DATE)
+            else:
+                warnings.warn("setuptools >= 62.2.0 required to generate man 
pages with pyprojects.toml")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/argparse-manpage-4.1/tox.ini 
new/argparse-manpage-4.3/tox.ini
--- old/argparse-manpage-4.1/tox.ini    2023-04-15 21:12:23.000000000 +0200
+++ new/argparse-manpage-4.3/tox.ini    2023-05-17 15:02:31.000000000 +0200
@@ -4,5 +4,8 @@
 skipsdist = True
 
 [testenv]
-deps = -rtest-requirements.txt
+deps =
+    pytest
+    setuptools
+    py{36,37,38,39,310}: tomli
 commands = python -m pytest -v {posargs}

Reply via email to