From ea48b7c136ddbf216cbf054b7612a3f597840da1f54c0d02e0dedbd3b1cb3049 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 14 Jun 2023 05:58:26 +0000 Subject: [PATCH] - Rejig sphinx.patch to not require Sphinx's setuptools machinery. - Add patch new-setuptools.patch, remove-six.patch. - Declare -doc subpackage as noarch. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-nss?expand=0&rev=14 --- new-setuptools.patch | 9 +++++++++ python-nss.changes | 7 +++++++ python-nss.spec | 19 ++++++++++++------ remove-six.patch | 42 +++++++++++++++++++++++++++++++++++++++ sphinx.patch | 47 ++++++++++++++++++++------------------------ 5 files changed, 92 insertions(+), 32 deletions(-) create mode 100644 new-setuptools.patch create mode 100644 remove-six.patch diff --git a/new-setuptools.patch b/new-setuptools.patch new file mode 100644 index 0000000..cef4cc2 --- /dev/null +++ b/new-setuptools.patch @@ -0,0 +1,9 @@ +Index: python-nss-1.0.1/setup.cfg +=================================================================== +--- python-nss-1.0.1.orig/setup.cfg ++++ python-nss-1.0.1/setup.cfg +@@ -1,3 +1,3 @@ + [sdist] + formats = bztar +-dist-dir = ++dist_dir = diff --git a/python-nss.changes b/python-nss.changes index 3ca42ce..8bc33b8 100644 --- a/python-nss.changes +++ b/python-nss.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Jun 14 05:57:12 UTC 2023 - Steve Kowalik + +- Rejig sphinx.patch to not require Sphinx's setuptools machinery. +- Add patch new-setuptools.patch, remove-six.patch. +- Declare -doc subpackage as noarch. + ------------------------------------------------------------------- Tue Jan 11 21:19:25 UTC 2022 - Dirk Müller diff --git a/python-nss.spec b/python-nss.spec index a799692..7fc34bf 100644 --- a/python-nss.spec +++ b/python-nss.spec @@ -1,7 +1,7 @@ # # spec file for package python-nss # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,9 +27,13 @@ Source: https://files.pythonhosted.org/packages/source/p/python-nss/pyth # PATCH-FIX-UPSTREAM 0001-Rename-DSA-RSA-PublicKey-to-Py-DSA-RSA-PublicKey.patch bmo#1474274 mcepl@suse.com # Incompatibility with NSS 3.58+ Patch0: 0001-Rename-DSA-RSA-PublicKey-to-Py-DSA-RSA-PublicKey.patch -# PATCH-FIX-UPSTREAM sphinx.patch bsc#[0-9]+ mcepl@suse.com -# this patch makes things totally awesome +# PATCH-FIX-OPENSUSE sphinx.patch mcepl@suse.com +# Include sphinx configuration to build docs Patch1: sphinx.patch +# PATCH-FIX-OPENSUSE Switch from dist-dir to dist_dir to stop setuptools whine +Patch2: new-setuptools.patch +# PATCH-FIX-OPENSUSE Stop using six in tests +Patch3: remove-six.patch BuildRequires: %{python_module Sphinx} BuildRequires: %{python_module devel} BuildRequires: %{python_module docutils} @@ -52,6 +56,7 @@ projects. NSS is FIPS-140 certified. %package -n %{name}-doc Summary: Documentation files for %name Group: Documentation/Other +BuildArch: noarch %description -n %{name}-doc HTML Documentation and examples for %name. @@ -60,12 +65,13 @@ HTML Documentation and examples for %name. %autosetup -p1 -n python-nss-%{version} %build -%python_build build_doc -rm -rf build/sphinx/html/.buildinfo +%python_build %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitearch} +PYTHONPATH=%{buildroot}%{python_sitearch} python3 -m sphinx doc/sphinx/source build/sphinx/html +rm -rf build/sphinx/html/.buildinfo %check %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch} @@ -75,7 +81,8 @@ $python test/run_tests -i %files %{python_files} %license LICENSE.mpl LICENSE.lgpl LICENSE.gpl %doc README doc/ChangeLog -%{python_sitearch}/* +%{python_sitearch}/nss +%{python_sitearch}/python_nss-%{version}*info %files -n %{name}-doc %license LICENSE.mpl LICENSE.lgpl LICENSE.gpl diff --git a/remove-six.patch b/remove-six.patch new file mode 100644 index 0000000..2787ee7 --- /dev/null +++ b/remove-six.patch @@ -0,0 +1,42 @@ +Index: python-nss-1.0.1/test/setup_certs.py +=================================================================== +--- python-nss-1.0.1.orig/test/setup_certs.py ++++ python-nss-1.0.1/test/setup_certs.py +@@ -10,7 +10,6 @@ import subprocess + import sys + from string import Template + import tempfile +-import six + + #------------------------------------------------------------------------------- + logger = None +@@ -510,7 +509,7 @@ def setup_certs(args): + continue + value = getattr(options, key) + # Can't substitue on non-string values +- if not isinstance(value, six.string_types): ++ if not isinstance(value, str): + continue + # Don't bother trying to substitute if $ substitution character isn't present + if '$' not in value: +Index: python-nss-1.0.1/test/test_misc.py +=================================================================== +--- python-nss-1.0.1.orig/test/test_misc.py ++++ python-nss-1.0.1/test/test_misc.py +@@ -5,7 +5,6 @@ import os + import unittest + + import nss.nss as nss +-import six + + #------------------------------------------------------------------------------- + class TestVersion(unittest.TestCase): +@@ -27,7 +26,7 @@ class TestShutdownCallback(unittest.Test + self.assertEqual(isinstance(i, int), True) + self.assertEqual(i, int_value) + +- self.assertEqual(isinstance(s, six.string_types), True) ++ self.assertTrue(isinstance(s, str)) + self.assertEqual(s, str_value) + + self.assertEqual(isinstance(d, dict), True) diff --git a/sphinx.patch b/sphinx.patch index 3b988c6..28719ca 100644 --- a/sphinx.patch +++ b/sphinx.patch @@ -1,6 +1,7 @@ -diff -r d767ac371ee3 doc/sphinx/source/conf.py ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/doc/sphinx/source/conf.py Fri Jul 06 11:24:08 2018 -0400 +Index: python-nss-1.0.1/doc/sphinx/source/conf.py +=================================================================== +--- /dev/null ++++ python-nss-1.0.1/doc/sphinx/source/conf.py @@ -0,0 +1,163 @@ +# -*- coding: utf-8 -*- +# @@ -67,7 +68,7 @@ diff -r d767ac371ee3 doc/sphinx/source/conf.py +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. -+language = None ++language = 'en' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. @@ -165,9 +166,10 @@ diff -r d767ac371ee3 doc/sphinx/source/conf.py + + +# -- Extension configuration ------------------------------------------------- -diff -r d767ac371ee3 doc/sphinx/source/index.rst ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/doc/sphinx/source/index.rst Fri Jul 06 11:24:08 2018 -0400 +Index: python-nss-1.0.1/doc/sphinx/source/index.rst +=================================================================== +--- /dev/null ++++ python-nss-1.0.1/doc/sphinx/source/index.rst @@ -0,0 +1,43 @@ +.. python-nss documentation master file, created by + sphinx-quickstart on Thu Jun 28 09:36:37 2018. @@ -191,7 +193,7 @@ diff -r d767ac371ee3 doc/sphinx/source/index.rst + +.. autosummary:: + :toctree: generated -+ ++ + nss.io + nss.ssl + nss.nss @@ -212,14 +214,13 @@ diff -r d767ac371ee3 doc/sphinx/source/index.rst + :maxdepth: 2 + :caption: Contents: + -diff -r d767ac371ee3 setup.py ---- a/setup.py Tue Feb 28 18:24:19 2017 -0500 -+++ b/setup.py Fri Jul 06 11:24:08 2018 -0400 -@@ -15,21 +15,25 @@ - from distutils.util import subst_vars, change_root +Index: python-nss-1.0.1/setup.py +=================================================================== +--- python-nss-1.0.1.orig/setup.py ++++ python-nss-1.0.1/setup.py +@@ -16,20 +16,23 @@ from distutils.util import subst_vars, c from distutils.command.build_py import build_py as _build_py from distutils.command.sdist import sdist as _sdist -+from sphinx.setup_command import BuildDoc as SphinxBuildDoc +name = 'python-nss' version = "1.0.1" @@ -244,7 +245,7 @@ diff -r d767ac371ee3 setup.py ] def update_version(): -@@ -114,13 +118,13 @@ +@@ -114,13 +117,13 @@ class BuildDoc(Command): user_options = [('docdir=', 'd', "directory root for documentation"), ] @@ -261,7 +262,7 @@ diff -r d767ac371ee3 setup.py ] def initialize_options(self): -@@ -137,46 +141,15 @@ +@@ -137,46 +140,15 @@ class BuildDoc(Command): def run(self): self.run_command('build') @@ -313,7 +314,7 @@ diff -r d767ac371ee3 setup.py class InstallDoc(Command): description = 'install documentation' -@@ -373,7 +346,7 @@ +@@ -373,7 +345,7 @@ def main(argv): #bug_tracker = 'https://bugzilla.redhat.com/buglist.cgi?submit&component=python-nss&product=Fedora&classification=Fedora' #bug_enter = 'https://bugzilla.redhat.com/enter_bug.cgi?component=python-nss&product=Fedora&classification=Fedora', @@ -322,23 +323,17 @@ diff -r d767ac371ee3 setup.py version = version, description = 'Python bindings for Network Security Services (NSS) and Netscape Portable Runtime (NSPR)', long_description = long_description, -@@ -393,12 +366,17 @@ +@@ -393,12 +365,10 @@ def main(argv): package_dir = {'nss':'src'}, packages = ['nss'], cmdclass = {'build_doc' : BuildDoc, - 'build_api_doc' : BuildApiDoc, -+ 'build_sphinx' : SphinxBuildDoc, 'install_doc' : InstallDoc, 'build_py' : BuildPy, 'sdist' : SDist, - }, +- }, - -+ command_options={ -+ 'build_sphinx': { -+ 'project': ('setup.py', name), -+ 'version': ('setup.py', version), -+ 'release': ('setup.py', release), -+ 'source_dir': ('setup.py', 'doc/sphinx/source')}}, ++ } ) return 0