From f6ebdac7439a4ef671285a84b4d2aa85bcbf15fae846193b9bda6f3a7ad172f0 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Fri, 27 Oct 2017 13:12:59 +0000 Subject: [PATCH 1/3] Accepting request 535443 from GNOME:Next This package cannot be noarch - as config.py contains info detected info, which is arch dependent OBS-URL: https://build.opensuse.org/request/show/535443 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk-doc?expand=0&rev=53 --- gtk-doc-Generate-main-sgml.patch | 47 ++++++++++++++++++++++++++++++++ gtk-doc.changes | 17 ++++++++++++ gtk-doc.spec | 12 ++++---- 3 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 gtk-doc-Generate-main-sgml.patch diff --git a/gtk-doc-Generate-main-sgml.patch b/gtk-doc-Generate-main-sgml.patch new file mode 100644 index 0000000..402cae5 --- /dev/null +++ b/gtk-doc-Generate-main-sgml.patch @@ -0,0 +1,47 @@ +From c08cc78562c59082fc83b55b58747177510b7a70 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Fri, 11 Aug 2017 21:06:59 +0200 +Subject: gtk-doc.make: Generate main sgml file by waiting on mkdb + +The 'empty' test fails on some machines when doing a parallel build, as +make cannot find tester-docs.xml. Add a rule to ensure make waits for +gtkdoc-mkdb to generate the file. +This will also fix first time parallel builds. + +https://bugzilla.gnome.org/show_bug.cgi?id=786174 +--- + gtk-doc.make | 3 +++ + tests/gtk-doc.make | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/gtk-doc.make b/gtk-doc.make +index e5777b6..d2a8b33 100644 +--- a/gtk-doc.make ++++ b/gtk-doc.make +@@ -152,6 +152,9 @@ sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HF + sgml.stamp: sgml-build.stamp + @true + ++$(DOC_MAIN_SGML_FILE): sgml-build.stamp ++ @true ++ + xml/gtkdocentities.ent: Makefile + $(GTK_DOC_V_XML)$(MKDIR_P) $(@D) && ( \ + echo ""; \ +diff --git a/tests/gtk-doc.make b/tests/gtk-doc.make +index 808fda4..cb8e164 100644 +--- a/tests/gtk-doc.make ++++ b/tests/gtk-doc.make +@@ -141,6 +141,9 @@ sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(HF + sgml.stamp: sgml-build.stamp + @true + ++$(DOC_MAIN_SGML_FILE): sgml-build.stamp ++ @true ++ + xml/gtkdocentities.ent: Makefile + @$(MKDIR_P) $(@D) && ( \ + echo ""; \ +-- +cgit v0.12 + diff --git a/gtk-doc.changes b/gtk-doc.changes index 0f8e41c..13dced8 100644 --- a/gtk-doc.changes +++ b/gtk-doc.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Fri Oct 20 09:08:01 UTC 2017 - dimstar@opensuse.org + +- Do not build as noarch: + /usr/share/gtk-doc/python/gtkdoc/config.py contains a full path + reference to $arch-pkg-config. + +------------------------------------------------------------------- +Tue Oct 10 22:00:57 UTC 2017 - zaitor@opensuse.org + +- Add gtk-doc-Generate-main-sgml.patch: Generate main sgml file by + waiting on mkdb. Fix first time parallel builds (bgo#786174). +- Following the above, add libtool BuildRequires and pass + autoreconf as the above patch touches the buildsystem. +- No longer pass --disable-scrollkeeper to configure, no longer + needed, nor recognized by configure. + ------------------------------------------------------------------- Mon Sep 4 12:44:28 UTC 2017 - dimstar@opensuse.org diff --git a/gtk-doc.spec b/gtk-doc.spec index f72d5f0..47312d6 100644 --- a/gtk-doc.spec +++ b/gtk-doc.spec @@ -23,10 +23,12 @@ Summary: GTK+ DocBook Documentation Generator License: GPL-2.0+ Group: Productivity/Publishing/SGML Url: http://www.gtk.org/gtk-doc/ +# When updating this package, please don't forget to update the gtk-doc.m4 Source in glib2. Source: https://download.gnome.org/sources/gtk-doc/1.26/%{name}-%{version}.tar.xz -# When updating this package, please don't forget to update the gtk-doc.m4 Source -# in glib2. +# PATCH-FIX-UPSTREAM gtk-doc-Generate-main-sgml.patch bgo#786174 -- Generate main sgml file by waiting on mkdb +Patch0: gtk-doc-Generate-main-sgml.patch BuildRequires: docbook-xsl-stylesheets +BuildRequires: libtool BuildRequires: libxml2-tools BuildRequires: openjade BuildRequires: pkgconfig @@ -47,7 +49,6 @@ Recommends: source-highlight # Old for <= 10.2 & CODE10 Provides: gtkdoc = %{version} Obsoletes: gtkdoc -BuildArch: noarch %description Gtkdoc is a set of Perl scripts that generate API reference @@ -59,9 +60,11 @@ generate the documentation for GLib, Gtk+, and GNOME. %prep %setup -q +%patch0 -p1 %build -%configure --disable-scrollkeeper +autoreconf -fiv +%configure make %{?_smp_mflags} %install @@ -73,7 +76,6 @@ mv -v doc/README doc/doc.README %find_lang %{name}-manual %{?no_lang_C} %files -%defattr(-,root,root) %doc AUTHORS COPYING COPYING-DOCS ChangeLog NEWS README TODO doc/* %{_bindir}/gtkdoc-* %{_bindir}/gtkdocize From 512cb7f8ccab8119ea3c002878415618c4d1571a57fdf776beb4d6d591f6c448 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 30 Oct 2017 14:26:37 +0000 Subject: [PATCH 2/3] Accepting request 537544 from GNOME:Next Let's use python3 for gtk-doc OBS-URL: https://build.opensuse.org/request/show/537544 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk-doc?expand=0&rev=54 --- gtk-doc-open-docs-as-utf8.patch | 626 ++++++++++++++++++++++++++++++++ gtk-doc.changes | 8 + gtk-doc.spec | 5 +- 3 files changed, 638 insertions(+), 1 deletion(-) create mode 100644 gtk-doc-open-docs-as-utf8.patch diff --git a/gtk-doc-open-docs-as-utf8.patch b/gtk-doc-open-docs-as-utf8.patch new file mode 100644 index 0000000..f657c3c --- /dev/null +++ b/gtk-doc-open-docs-as-utf8.patch @@ -0,0 +1,626 @@ +commit 8ad03e164f3091df68a9fed5492b54cd61d0ac51 +Author: Stefan Sauer +Date: Thu Oct 26 22:16:57 2017 +0200 + + mkdb: don't uses sys.exit in library + + Just print a warning and go on. + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index 3b0bc15..d89d078 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -31,7 +31,6 @@ import logging + import os + import re + import string +-import sys + + from . import common, md_to_db + +@@ -1123,7 +1122,8 @@ def OutputDeclaration(symbol, declaration): + elif dtype == 'USER_FUNCTION': + return OutputFunction(symbol, declaration, dtype) + else: +- sys.exit("Unknown symbol type " + dtype) ++ logging.warning("Unknown symbol type %s for symbol %s", dtype, symbol) ++ return ('', '') + + + def OutputSymbolTraits(symbol): + +commit a4a719606bfa0abdea794f6a7d4f46b3e3fcb77e +Author: Stefan Sauer +Date: Thu Oct 26 21:06:17 2017 +0200 + + mkdb: fix missing info on typedefs + + This was a regression from the perl->python port. + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index 7bb6d3e..3b0bc15 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -1281,7 +1281,7 @@ def OutputTypedef(symbol, declaration): + desc += "\n" + desc += OutputSymbolExtraLinks(symbol) + +- if symbol in DeclarationConditional: ++ if symbol not in DeclarationConditional: + decl_out = CreateValidSGML(declaration) + desc += "%s\n" % decl_out + + +commit 21358879180c9e988fc0473840ab8ab673f69513 +Author: Christoph Reiter +Date: Wed Oct 25 21:27:05 2017 +0200 + + mkdb: Mark multiple Unicode strings as such + + These are utf-8 encoded byte strings under Python 2 and when concatonated + with unicode objects get auto-decoded using the default ascii encoding, + which fails as they are not ascii. + + https://bugzilla.gnome.org/show_bug.cgi?id=787862 + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index 6c1538f..7bb6d3e 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -2784,14 +2784,14 @@ def MakeHashXRef(symbol, tag): + if '::' in symbol: + o, s = symbol.split('::', 1) + symbol = '%s-%s' % (o, s) +- text = '“' + s + '”' ++ text = u'“' + s + u'”' + + # If the symbol is in the form "Object:property", then change the symbol to + # "Object--property" and use "property" as the text. + if ':' in symbol: + o, p = symbol.split(':', 1) + symbol = '%s--%s' % (o, p) +- text = '“' + p + '”' ++ text = u'“' + p + u'”' + + if tag != '': + text = tagify(text, tag) +@@ -3311,7 +3311,7 @@ def GetSignals(gobject): + symbol = '%s::%s' % (gobject, name) + sid = common.CreateValidSGMLID('%s-%s' % (gobject, name)) + +- desc += "The <literal>“%s”</literal> signal\n" % ( ++ desc += u"The <literal>“%s”</literal> signal\n" % ( + sid, name) + desc += MakeIndexterms(symbol, sid) + desc += "\n" +@@ -3546,13 +3546,13 @@ def GetArgs(gobject): + + arg_synop = "%s%s%s\n" % ( + type_output, sid, name, flags_string) +- arg_desc = "The <literal>“%s”</literal> %s\n" % ( ++ arg_desc = u"The <literal>“%s”</literal> %s\n" % ( + sid, name, kind) + arg_desc += MakeIndexterms(symbol, sid) + arg_desc += "\n" + arg_desc += OutputSymbolExtraLinks(symbol) + +- arg_desc += " “%s”%s %s\n" % (name, pad1, type_output) ++ arg_desc += u" “%s”%s %s\n" % (name, pad1, type_output) + arg_desc += blurb + if symbol in SymbolAnnotations: + param_desc = SymbolAnnotations[symbol] + +commit 1eeec38a9a06a9956cdab9789cbd2ea105866198 +Author: Christoph Reiter +Date: Mon Sep 18 22:49:09 2017 +0200 + + Always open files in text mode and always use utf-8 + + Introduces a common.open_text() helper with saner defaults for opening + text files across Python versions. + + open() defaults to the locale encoding which on a properly configured + Unix is utf-8, but cp-1252 on Windows which can't handle all of Unicode. + Instead of using the default always use utf-8 for text files. + + To reduce the difference of types processed by Python 2 vs 3 use + codecs.open() to open text files in text mode on Python 2. The + resulting file object will return unicode like on Python 3, but still + allows passing in ASCII only str. + + Also fixes a few missing file.close() operations, which is important on + Windows as non-closed files can't be renamed/deleted on Windows. + + https://bugzilla.gnome.org/show_bug.cgi?id=787862 + +diff --git a/gtkdoc/check.py b/gtkdoc/check.py +index 0a58b0c..7f32b60 100755 +--- a/gtkdoc/check.py ++++ b/gtkdoc/check.py +@@ -32,6 +32,8 @@ import os + import re + from glob import glob + ++from . import common ++ + + class FileFormatError(Exception): + pass +@@ -46,14 +48,14 @@ def grep(regexp, lines, what): + + + def check_empty(filename): +- with open(filename) as f: ++ with open(filename, "rb") as f: + count = sum(1 for line in f if line.strip()) + return count + + + def check_includes(filename): + # Check that each XML file in the xml directory is included in doc_main_file +- with open(filename) as f: ++ with common.open_text(filename) as f: + lines = f.read().splitlines() + num_missing = 0 + for include in glob('xml/*.xml'): +@@ -73,7 +75,7 @@ def get_variable(env, lines, variable): + + + def read_file(filename): +- with open(filename) as f: ++ with common.open_text(filename) as f: + return f.read().splitlines() + + +diff --git a/gtkdoc/common.py b/gtkdoc/common.py +index 50c9f5f..9dfebef 100644 +--- a/gtkdoc/common.py ++++ b/gtkdoc/common.py +@@ -28,10 +28,35 @@ import os + import re + import subprocess + import sys ++import six ++import codecs + + from . import config + + ++def open_text(filename, mode="r", encoding="utf-8"): ++ """An open() which removes some differences between Python 2 and 3 and ++ has saner defaults. ++ ++ Unlike the builtin open by default utf-8 is use and not the locale ++ encoding (which is ANSI on Windows for example, not very helpful) ++ ++ For Python 2, files are opened in text mode like with Python 3. ++ """ ++ ++ if mode not in ("r", "w"): ++ raise ValueError("mode %r not supported, must be 'r' or 'w'" % mode) ++ ++ if six.PY3: ++ return open(filename, mode, encoding=encoding) ++ else: ++ # We can't use io.open() here as its write method is too strict and ++ # only allows unicode instances and not everything in the codebase ++ # forces unicode at the moment. codecs.open() on the other hand ++ # happily takes ASCII str and decodes it. ++ return codecs.open(filename, mode, encoding=encoding) ++ ++ + def setup_logging(): + """Check GTKDOC_TRACE environment variable. + +diff --git a/gtkdoc/fixxref.py b/gtkdoc/fixxref.py +index 3027c10..164b008 100755 +--- a/gtkdoc/fixxref.py ++++ b/gtkdoc/fixxref.py +@@ -175,7 +175,7 @@ def ReadDevhelp(file, use_absolute_links): + + logging.info('Scanning index file=%s, absolute=%d, dir=%s', file, use_absolute_links, dir) + +- for line in open(file): ++ for line in common.open_text(file): + m = re.search(r' link="([^#]*)#([^"]*)"', line) + if m: + link = m.group(1) + '#' + m.group(2) +@@ -184,7 +184,7 @@ def ReadDevhelp(file, use_absolute_links): + + + def ReadSections(options): +- for line in open(options.module + '-sections.txt'): ++ for line in common.open_text(options.module + '-sections.txt'): + m1 = re.search(r'^', line) + if line.startswith('#') or line.strip() == '': + continue +@@ -220,9 +220,7 @@ def FixCrossReferences(options): + def FixHTMLFile(options, file): + logging.info('Fixing file: %s', file) + +- content = open(file).read() +- if sys.version_info < (3,): +- content = content.decode('utf-8') ++ content = common.open_text(file).read() + + if config.highlight: + # FIXME: ideally we'd pass a clue about the example language to the highligher +@@ -266,9 +264,8 @@ def FixHTMLFile(options, file): + + new_file = file + '.new' + content = '\n'.join(lines) +- if sys.version_info < (3,): +- content = content.encode('utf-8') +- open(new_file, 'w').write(content) ++ with common.open_text(new_file, 'w') as h: ++ h.write(content) + + os.unlink(file) + os.rename(new_file, file) +@@ -381,7 +378,7 @@ def HighlightSourceVim(options, type, source): + script += "%s -n -e -u NONE -T xterm >/dev/null" % config.highlight + subprocess.check_call([script], shell=True) + +- highlighted_source = open(temp_source_file + ".html").read() ++ highlighted_source = common.open_text(temp_source_file + ".html").read() + highlighted_source = re.sub(r'.*]*>\n', '', highlighted_source, flags=re.MULTILINE) + highlighted_source = re.sub(r'.*', '', highlighted_source, flags=re.MULTILINE) + +diff --git a/gtkdoc/mkdb.py b/gtkdoc/mkdb.py +index e103138..6c1538f 100644 +--- a/gtkdoc/mkdb.py ++++ b/gtkdoc/mkdb.py +@@ -302,7 +302,8 @@ def Run(options): + OutputSinceIndexes() + OutputAnnotationGlossary() + +- open(os.path.join(ROOT_DIR, 'sgml.stamp'), 'w').write('timestamp') ++ with open(os.path.join(ROOT_DIR, 'sgml.stamp'), 'w') as h: ++ h.write('timestamp') + + + def OutputObjectList(): +@@ -315,7 +316,7 @@ def OutputObjectList(): + old_object_index = os.path.join(DB_OUTPUT_DIR, "object_index.sgml") + new_object_index = os.path.join(DB_OUTPUT_DIR, "object_index.new") + +- OUTPUT = open(new_object_index, 'w') ++ OUTPUT = common.open_text(new_object_index, 'w') + + OUTPUT.write('''%s + +@@ -377,7 +378,7 @@ def OutputDB(file, options): + """ + + logging.info("Reading: %s", file) +- INPUT = open(file) ++ INPUT = common.open_text(file) + filename = '' + book_top = '' + book_bottom = '' +@@ -1001,7 +1002,7 @@ def OutputAnnotationGlossary(): + rerun = True + break + +- OUTPUT = open(new_glossary, 'w') ++ OUTPUT = common.open_text(new_glossary, 'w') + + OUTPUT.write('''%s + +@@ -1049,7 +1050,7 @@ def ReadKnownSymbols(file): + subsection = '' + + logging.info("Reading: %s", file) +- INPUT = open(file) ++ INPUT = common.open_text(file) + for line in INPUT: + if line.startswith('#'): + continue +@@ -2157,7 +2158,7 @@ def OutputDBFile(file, title, section_id, includes, functions_synop, other_synop + old_db_file = os.path.join(DB_OUTPUT_DIR, file + '.xml') + new_db_file = os.path.join(DB_OUTPUT_DIR, file + '.xml.new') + +- OUTPUT = open(new_db_file, 'w') ++ OUTPUT = common.open_text(new_db_file, 'w') + + object_anchors = '' + for fobject in file_objects: +@@ -2324,7 +2325,7 @@ def OutputProgramDBFile(program, section_id): + old_db_file = os.path.join(DB_OUTPUT_DIR, program + ".xml") + new_db_file = os.path.join(DB_OUTPUT_DIR, program + ".xml.new") + +- OUTPUT = open(new_db_file, 'w') ++ OUTPUT = common.open_text(new_db_file, 'w') + + OUTPUT.write('''%s + +@@ -2367,9 +2368,9 @@ def OutputExtraFile(file): + old_db_file = os.path.join(DB_OUTPUT_DIR, basename) + new_db_file = os.path.join(DB_OUTPUT_DIR, basename + ".new") + +- contents = open(file).read() ++ contents = common.open_text(file).read() + +- OUTPUT = open(new_db_file, 'w') ++ OUTPUT = common.open_text(new_db_file, 'w') + OUTPUT.write(ExpandAbbreviations(basename + " file", contents)) + OUTPUT.close() + +@@ -2378,7 +2379,7 @@ def OutputExtraFile(file): + + def GetDocbookHeader(main_file): + if os.path.exists(main_file): +- INPUT = open(main_file) ++ INPUT = common.open_text(main_file) + header = '' + for line in INPUT: + if re.search(r'^\s*<(book|chapter|article)', line): +@@ -2421,7 +2422,7 @@ def OutputBook(main_file, book_top, book_bottom): + old_file = os.path.join(DB_OUTPUT_DIR, MODULE + "-doc.top") + new_file = os.path.join(DB_OUTPUT_DIR, MODULE + "-doc.top.new") + +- OUTPUT = open(new_file, 'w') ++ OUTPUT = common.open_text(new_file, 'w') + OUTPUT.write(book_top) + OUTPUT.close() + +@@ -2430,7 +2431,7 @@ def OutputBook(main_file, book_top, book_bottom): + old_file = os.path.join(DB_OUTPUT_DIR, MODULE + "-doc.bottom") + new_file = os.path.join(DB_OUTPUT_DIR, MODULE + "-doc.bottom.new") + +- OUTPUT = open(new_file, 'w') ++ OUTPUT = common.open_text(new_file, 'w') + OUTPUT.write(book_bottom) + OUTPUT.close() + +@@ -2439,7 +2440,7 @@ def OutputBook(main_file, book_top, book_bottom): + # If the main docbook file hasn't been created yet, we create it here. + # The user can tweak it later. + if main_file and not os.path.exists(main_file): +- OUTPUT = open(main_file, 'w') ++ OUTPUT = common.open_text(main_file, 'w') + + logging.info("no master doc, create default one at: " + main_file) + +@@ -3665,7 +3666,7 @@ def ScanSourceFile(ifile, ignore_files): + + logging.info("Scanning source file: %s", ifile) + +- SRCFILE = open(ifile) ++ SRCFILE = common.open_text(ifile) + in_comment_block = False + symbol = None + in_part = '' +@@ -3983,7 +3984,7 @@ def OutputMissingDocumentation(): + buffer_deprecated = '' + buffer_descriptions = '' + +- UNDOCUMENTED = open(new_undocumented_file, 'w') ++ UNDOCUMENTED = common.open_text(new_undocumented_file, 'w') + + for symbol in sorted(iterkeys(AllSymbols)): + # FIXME: should we print common.LogWarnings for undocumented stuff? +@@ -4064,7 +4065,7 @@ def OutputUndeclaredSymbols(): + old_undeclared_file = os.path.join(ROOT_DIR, MODULE + "-undeclared.txt") + new_undeclared_file = os.path.join(ROOT_DIR, MODULE + "-undeclared.new") + +- UNDECLARED = open(new_undeclared_file, 'w') ++ UNDECLARED = common.open_text(new_undeclared_file, 'w') + + if UndeclaredSymbols: + UNDECLARED.write("\n".join(sorted(iterkeys(UndeclaredSymbols)))) +@@ -4089,7 +4090,7 @@ def OutputUnusedSymbols(): + old_unused_file = os.path.join(ROOT_DIR, MODULE + "-unused.txt") + new_unused_file = os.path.join(ROOT_DIR, MODULE + "-unused.new") + +- UNUSED = open(new_unused_file, 'w') ++ UNUSED = common.open_text(new_unused_file, 'w') + + for symbol in sorted(iterkeys(Declarations)): + if not symbol in DeclarationOutput: +@@ -4110,7 +4111,7 @@ def OutputUnusedSymbols(): + + def OutputAllSymbols(): + """Outputs list of all symbols to a file.""" +- SYMBOLS = open(os.path.join(ROOT_DIR, MODULE + "-symbols.txt"), 'w') ++ SYMBOLS = common.open_text(os.path.join(ROOT_DIR, MODULE + "-symbols.txt"), 'w') + + for symbol in sorted(iterkeys(AllSymbols)): + SYMBOLS.write(symbol + "\n") +@@ -4119,7 +4120,7 @@ def OutputAllSymbols(): + + def OutputSymbolsWithoutSince(): + """Outputs list of all symbols without a since tag to a file.""" +- SYMBOLS = open(os.path.join(ROOT_DIR, MODULE + "-nosince.txt"), 'w') ++ SYMBOLS = common.open_text(os.path.join(ROOT_DIR, MODULE + "-nosince.txt"), 'w') + + for symbol in sorted(iterkeys(SourceSymbolDocs)): + if symbol in Since: +@@ -4257,7 +4258,7 @@ def ReadDeclarationsFile(ifile, override): + DeclarationConditional.clear() + DeclarationOutput.clear() + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + declaration_type = '' + declaration_name = None + declaration = None +@@ -4371,7 +4372,7 @@ def ReadSignalsFile(ifile): + if not os.path.isfile(ifile): + return + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + line_number = 0 + for line in INPUT: + line_number += 1 +@@ -4437,7 +4438,7 @@ def ReadObjectHierarchy(ifile): + logging.debug('no *-hierarchy.tx') + return + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + + # Only emit objects if they are supposed to be documented, or if + # they have documented children. To implement this, we maintain a +@@ -4488,7 +4489,7 @@ def ReadObjectHierarchy(ifile): + + logging.debug('got %d entries for hierarchy', len(tree)) + +- OUTPUT = open(new_tree_index, 'w') ++ OUTPUT = common.open_text(new_tree_index, 'w') + OUTPUT.write(MakeDocHeader("screen") + "\n\n" + AddTreeLineArt(tree) + "\n\n") + OUTPUT.close() + +@@ -4509,7 +4510,7 @@ def ReadInterfaces(ifile): + if not os.path.isfile(ifile): + return + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + + for line in INPUT: + line = line.strip() +@@ -4542,7 +4543,7 @@ def ReadPrerequisites(ifile): + if not os.path.isfile(ifile): + return + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + + for line in INPUT: + line = line.strip() +@@ -4593,7 +4594,7 @@ def ReadArgsFile(ifile): + if not os.path.isfile(ifile): + return + +- INPUT = open(ifile) ++ INPUT = common.open_text(ifile) + line_number = 0 + for line in INPUT: + line_number += 1 +diff --git a/gtkdoc/mkhtml.py b/gtkdoc/mkhtml.py +index 80ddadf..3d03e0a 100644 +--- a/gtkdoc/mkhtml.py ++++ b/gtkdoc/mkhtml.py +@@ -90,5 +90,6 @@ def run(options): + for f in glob(styledir + '/*.png') + glob(styledir + '/*.css'): + shutil.copy(f, '.') + +- open('../html.stamp', 'w').write('timestamp') ++ with open('../html.stamp', 'w') as h: ++ h.write('timestamp') + return res +diff --git a/gtkdoc/mkpdf.py b/gtkdoc/mkpdf.py +index 5fd9ecb..485b487 100755 +--- a/gtkdoc/mkpdf.py ++++ b/gtkdoc/mkpdf.py +@@ -37,7 +37,8 @@ def run_xsltproc(options, args): + command += ['--path', path] + pc = subprocess.Popen(command + args, stderr=subprocess.PIPE) + (o, stde) = pc.communicate() +- open('profile.txt', 'wb').write(stde) ++ with open('profile.txt', 'wb') as h: ++ h.write(stde) + return pc.returncode + + +@@ -118,5 +119,6 @@ def run(options): + print("dblatex or fop must be installed to use gtkdoc-mkpdf.") + res = 1 + +- open('pdf.stamp', 'w').write('timestamp') ++ with open('pdf.stamp', 'w') as h: ++ h.write('timestamp') + return res +diff --git a/gtkdoc/rebase.py b/gtkdoc/rebase.py +index e518586..b329c51 100755 +--- a/gtkdoc/rebase.py ++++ b/gtkdoc/rebase.py +@@ -136,7 +136,7 @@ gunzip %s/%s + def ReadDevhelp(dir, file): + onlinedir = None + +- for line in open(os.path.join(dir, file)): ++ for line in common.open_text(os.path.join(dir, file)): + # online must come before chapter/functions + if '\s*\*/', line): + return +diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py +index e6db6cd..116270a 100644 +--- a/gtkdoc/scangobj.py ++++ b/gtkdoc/scangobj.py +@@ -1185,7 +1185,7 @@ MAIN_CODE_END = """ + def run(options): + + c_file = options.module + '-scan.c' +- output = open(c_file, 'w') ++ output = common.open_text(c_file, 'w') + + base_filename = os.path.join(options.output_dir, options.module) + old_signals_filename = base_filename + '.signals' +@@ -1206,7 +1206,7 @@ def run(options): + get_types = "" + ntypes = 1 + +- for line in open(options.types): ++ for line in common.open_text(options.types): + if line.startswith('#include'): + includes += line + elif line.startswith('%') or line.strip() == '': diff --git a/gtk-doc.changes b/gtk-doc.changes index 13dced8..d5a4a76 100644 --- a/gtk-doc.changes +++ b/gtk-doc.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Oct 24 14:40:59 UTC 2017 - dimstar@opensuse.org + +- Switch to python3: add PYTHON=%{_bindir}/python3 to configure. +- Add: gtk-doc-open-docs-as-utf8.patch: Always open files using + utf-8. In python3, strings are differently represented + internally. + ------------------------------------------------------------------- Fri Oct 20 09:08:01 UTC 2017 - dimstar@opensuse.org diff --git a/gtk-doc.spec b/gtk-doc.spec index 47312d6..b3c3fe1 100644 --- a/gtk-doc.spec +++ b/gtk-doc.spec @@ -27,6 +27,8 @@ Url: http://www.gtk.org/gtk-doc/ Source: https://download.gnome.org/sources/gtk-doc/1.26/%{name}-%{version}.tar.xz # PATCH-FIX-UPSTREAM gtk-doc-Generate-main-sgml.patch bgo#786174 -- Generate main sgml file by waiting on mkdb Patch0: gtk-doc-Generate-main-sgml.patch +# PATCH-FIX-UPSTREAM gtk-doc-open-docs-as-utf8.patch dimstar@opensuse.org -- Always open files using utf-8 +Patch1: gtk-doc-open-docs-as-utf8.patch BuildRequires: docbook-xsl-stylesheets BuildRequires: libtool BuildRequires: libxml2-tools @@ -61,10 +63,11 @@ generate the documentation for GLib, Gtk+, and GNOME. %prep %setup -q %patch0 -p1 +%patch1 -p1 %build autoreconf -fiv -%configure +%configure PYTHON=%{_bindir}/python3 make %{?_smp_mflags} %install From 8e0e7287653741bd19affce4c6bab7e0e3368d29ba3df470041ae813bf92354b Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Mon, 30 Oct 2017 14:38:29 +0000 Subject: [PATCH 3/3] How stupid.. and why did this even work in G:N OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk-doc?expand=0&rev=55 --- gtk-doc.spec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtk-doc.spec b/gtk-doc.spec index b3c3fe1..2d8d4df 100644 --- a/gtk-doc.spec +++ b/gtk-doc.spec @@ -34,7 +34,7 @@ BuildRequires: libtool BuildRequires: libxml2-tools BuildRequires: openjade BuildRequires: pkgconfig -BuildRequires: python-base +BuildRequires: python3-base BuildRequires: sgml-skel BuildRequires: xsltproc BuildRequires: yelp-tools @@ -43,7 +43,6 @@ Requires: docbook_4 Requires: glib2-devel Requires: libxml2-tools Requires: openjade -Requires: python-six Requires: python3-six Requires: xsltproc Recommends: %{name}-lang