Add python3 support
This commit is contained in:
parent
8aabfa792a
commit
ee020b430c
@ -1,38 +0,0 @@
|
||||
From adb0929f0db4da533a9d5b317e6f49a91feb3b3e Mon Sep 17 00:00:00 2001
|
||||
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
|
||||
Date: Tue, 3 Dec 2013 18:03:13 +0100
|
||||
Subject: [PATCH] [a2x] Write manifests in UTF-8 by default
|
||||
|
||||
This is a workaround for rhbz#968308 where a2x tries to write non-ASCII content
|
||||
epub manifest. Since the write_file is mostly used to write xml content which
|
||||
defaults to UTF-8 this seems fairly safe
|
||||
---
|
||||
a2x.py | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/a2x.py b/a2x.py
|
||||
index 1b192a2..ad163e3 100755
|
||||
--- a/a2x.py
|
||||
+++ b/a2x.py
|
||||
@@ -21,6 +21,7 @@ import urlparse
|
||||
import zipfile
|
||||
import xml.dom.minidom
|
||||
import mimetypes
|
||||
+import codecs
|
||||
|
||||
PROG = os.path.basename(os.path.splitext(__file__)[0])
|
||||
VERSION = '8.6.8'
|
||||
@@ -144,8 +145,8 @@ def find_executable(file_name):
|
||||
result = _find_executable(file_name)
|
||||
return result
|
||||
|
||||
-def write_file(filename, data, mode='w'):
|
||||
- f = open(filename, mode)
|
||||
+def write_file(filename, data, mode='w', encoding='utf-8'):
|
||||
+ f = codecs.open(filename, mode, encoding)
|
||||
try:
|
||||
f.write(data)
|
||||
finally:
|
||||
--
|
||||
1.8.4.2
|
||||
|
@ -1,73 +0,0 @@
|
||||
diff -up asciidoc-8.6.8/a2x.py.explicit-interpreter asciidoc-8.6.8/a2x.py
|
||||
--- asciidoc-8.6.8/a2x.py.explicit-interpreter 2014-02-10 17:09:28.400042041 +0100
|
||||
+++ asciidoc-8.6.8/a2x.py 2014-02-10 17:16:54.945502122 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
'''
|
||||
a2x - A toolchain manager for AsciiDoc (converts Asciidoc text files to other
|
||||
file formats)
|
||||
diff -up asciidoc-8.6.8/asciidocapi.py.explicit-interpreter asciidoc-8.6.8/asciidocapi.py
|
||||
--- asciidoc-8.6.8/asciidocapi.py.explicit-interpreter 2012-02-29 23:21:24.000000000 +0100
|
||||
+++ asciidoc-8.6.8/asciidocapi.py 2014-02-10 17:16:54.932502080 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
"""
|
||||
asciidocapi - AsciiDoc API wrapper class.
|
||||
|
||||
diff -up asciidoc-8.6.8/asciidoc.py.explicit-interpreter asciidoc-8.6.8/asciidoc.py
|
||||
--- asciidoc-8.6.8/asciidoc.py.explicit-interpreter 2012-07-10 04:47:22.000000000 +0200
|
||||
+++ asciidoc-8.6.8/asciidoc.py 2014-02-10 17:16:54.960502172 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
"""
|
||||
asciidoc - converts an AsciiDoc text file to HTML or DocBook
|
||||
|
||||
diff -up asciidoc-8.6.8/filters/code/code-filter.py.explicit-interpreter asciidoc-8.6.8/filters/code/code-filter.py
|
||||
--- asciidoc-8.6.8/filters/code/code-filter.py.explicit-interpreter 2008-12-31 02:37:47.000000000 +0100
|
||||
+++ asciidoc-8.6.8/filters/code/code-filter.py 2014-02-10 17:16:54.939502103 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
'''
|
||||
NAME
|
||||
code-filter - AsciiDoc filter to highlight language keywords
|
||||
diff -up asciidoc-8.6.8/filters/graphviz/graphviz2png.py.explicit-interpreter asciidoc-8.6.8/filters/graphviz/graphviz2png.py
|
||||
--- asciidoc-8.6.8/filters/graphviz/graphviz2png.py.explicit-interpreter 2011-01-31 21:52:09.000000000 +0100
|
||||
+++ asciidoc-8.6.8/filters/graphviz/graphviz2png.py 2014-02-10 17:16:54.941502110 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
|
||||
import os, sys, subprocess
|
||||
from optparse import *
|
||||
diff -up asciidoc-8.6.8/filters/latex/latex2png.py.explicit-interpreter asciidoc-8.6.8/filters/latex/latex2png.py
|
||||
--- asciidoc-8.6.8/filters/latex/latex2png.py.explicit-interpreter 2012-02-29 03:05:58.000000000 +0100
|
||||
+++ asciidoc-8.6.8/filters/latex/latex2png.py 2014-02-10 17:16:54.936502093 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
'''
|
||||
NAME
|
||||
latex2png - Converts LaTeX source to PNG file
|
||||
diff -up asciidoc-8.6.8/filters/music/music2png.py.explicit-interpreter asciidoc-8.6.8/filters/music/music2png.py
|
||||
--- asciidoc-8.6.8/filters/music/music2png.py.explicit-interpreter 2012-07-10 23:32:19.000000000 +0200
|
||||
+++ asciidoc-8.6.8/filters/music/music2png.py 2014-02-10 17:16:54.934502087 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
'''
|
||||
NAME
|
||||
music2png - Converts textual music notation to classically notated PNG file
|
||||
diff -up asciidoc-8.6.8/tests/asciidocapi.py.explicit-interpreter asciidoc-8.6.8/tests/asciidocapi.py
|
||||
diff -up asciidoc-8.6.8/tests/testasciidoc.py.explicit-interpreter asciidoc-8.6.8/tests/testasciidoc.py
|
||||
--- asciidoc-8.6.8/tests/testasciidoc.py.explicit-interpreter 2012-03-01 00:19:57.000000000 +0100
|
||||
+++ asciidoc-8.6.8/tests/testasciidoc.py 2014-02-10 17:16:54.965502188 +0100
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python2
|
||||
|
||||
USAGE = '''Usage: testasciidoc.py [OPTIONS] COMMAND
|
||||
|
39
asciidoc-python3.patch
Normal file
39
asciidoc-python3.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff -urNp old/filters/latex/latex2img.py new/filters/latex/latex2img.py
|
||||
--- old/filters/latex/latex2img.py 2018-06-05 15:27:44.153533130 +0200
|
||||
+++ new/filters/latex/latex2img.py 2018-06-05 15:28:43.542828463 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python2
|
||||
+#!/usr/bin/env python3
|
||||
'''
|
||||
NAME
|
||||
latex2img - Converts LaTeX source to PNG or SVG file
|
||||
diff -urNp old/filters/music/music2png.py new/filters/music/music2png.py
|
||||
--- old/filters/music/music2png.py 2018-06-05 15:27:44.153533130 +0200
|
||||
+++ new/filters/music/music2png.py 2018-06-05 15:28:56.502882780 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python2
|
||||
+#!/usr/bin/env python3
|
||||
'''
|
||||
NAME
|
||||
music2png - Converts textual music notation to classically notated PNG file
|
||||
diff -urNp old/filters/unwraplatex.py new/filters/unwraplatex.py
|
||||
--- old/filters/unwraplatex.py 2018-06-05 15:27:44.152533125 +0200
|
||||
+++ new/filters/unwraplatex.py 2018-06-05 15:28:29.956767744 +0200
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python2
|
||||
+#!/usr/bin/env python3
|
||||
'''
|
||||
NAME
|
||||
unwraplatex - Removes delimiters from LaTeX source text
|
||||
diff -urNp old/Makefile.in new/Makefile.in
|
||||
--- old/Makefile.in 2018-06-05 15:27:44.144533079 +0200
|
||||
+++ new/Makefile.in 2018-06-05 15:27:56.328600132 +0200
|
||||
@@ -107,7 +107,7 @@ $(DATATARGETS): % : %dir
|
||||
$(INSTALL_DATA) $($@) $(DESTDIR)/$($<)/
|
||||
|
||||
$(manp): %.1 : %.1.txt
|
||||
- python2 a2x.py -f manpage $<
|
||||
+ python3 a2x.py -f manpage $<
|
||||
|
||||
docs:
|
||||
$(INSTALL) -d $(DESTDIR)/$(docdir)
|
@ -1,10 +1,9 @@
|
||||
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
%global vimdir %{_datadir}/vim/vimfiles
|
||||
|
||||
Summary: Text based document generation
|
||||
Name: asciidoc
|
||||
Version: 8.6.8
|
||||
Release: 15%{?dist}
|
||||
Release: 16.986f99d%{?dist}
|
||||
# The python code does not specify a version.
|
||||
# The javascript example code is GPLv2+.
|
||||
License: GPL+ and GPLv2+
|
||||
@ -12,26 +11,27 @@ License: GPL+ and GPLv2+
|
||||
URL: http://www.methods.co.nz/asciidoc/
|
||||
Source: http://sourceforge.net/projects/asciidoc/files/%{name}/%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch1: 0001-a2x-Write-manifests-in-UTF-8-by-default.patch
|
||||
Patch2: asciidoc-8.6.8-explicit-interpreter.patch
|
||||
Patch1: asciidoc-python3.patch
|
||||
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: dblatex
|
||||
BuildRequires: docbook-style-xsl
|
||||
BuildRequires: graphviz
|
||||
BuildRequires: libxslt
|
||||
BuildRequires: lilypond
|
||||
BuildRequires: source-highlight
|
||||
BuildRequires: texlive-dvipng-bin
|
||||
BuildRequires: texlive-dvisvgm-bin
|
||||
BuildRequires: vim-filesystem
|
||||
BuildRequires: symlinks
|
||||
BuildRequires: automake
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: ImageMagick
|
||||
|
||||
Requires: python2 >= 2.4
|
||||
Requires: python3
|
||||
Requires: docbook-style-xsl
|
||||
Requires: graphviz
|
||||
Requires: libxslt
|
||||
Requires: libxslt
|
||||
Requires: source-highlight
|
||||
Requires: vim-filesystem
|
||||
|
||||
@ -74,15 +74,14 @@ Requires: lilypond
|
||||
sed -i "s/\r//g" COPYRIGHT
|
||||
|
||||
# Convert CHANGELOG and README to utf-8
|
||||
for file in CHANGELOG README; do
|
||||
for file in CHANGELOG README.asciidoc; do
|
||||
iconv -f ISO-8859-1 -t UTF-8 -o $file.new $file && \
|
||||
touch -r $file $file.new && \
|
||||
mv $file.new $file
|
||||
done
|
||||
|
||||
%build
|
||||
#allow python2 for build in RHEL
|
||||
export RHEL_ALLOW_PYTHON2_FOR_BUILD=1
|
||||
autoreconf -v
|
||||
%configure
|
||||
|
||||
%install
|
||||
@ -103,7 +102,7 @@ for d in dblatex docbook-xsl images javascripts stylesheets; do
|
||||
done
|
||||
|
||||
# Python API
|
||||
install -Dpm 644 asciidocapi.py %{buildroot}%{python2_sitelib}/asciidocapi.py
|
||||
install -Dpm 644 asciidocapi.py %{buildroot}%{python3_sitelib}/asciidocapi.py
|
||||
|
||||
# Make it easier to %exclude these with both rpm < and >= 4.7
|
||||
for file in %{buildroot}{%{_bindir},%{_sysconfdir}/asciidoc/filters/*}/*.py ; do
|
||||
@ -127,11 +126,11 @@ done
|
||||
%check
|
||||
export PATH="../:$PATH"
|
||||
cd tests
|
||||
%{__python2} testasciidoc.py update
|
||||
%{__python2} testasciidoc.py run
|
||||
%{__python3} testasciidoc.py update
|
||||
%{__python3} testasciidoc.py run
|
||||
|
||||
%files
|
||||
%doc COPYING COPYRIGHT BUGS CHANGELOG README
|
||||
%doc COPYING COPYRIGHT README.asciidoc
|
||||
%doc %{_mandir}/man1/a2x.1*
|
||||
%doc %{_mandir}/man1/asciidoc.1*
|
||||
%config(noreplace) %{_sysconfdir}/asciidoc/
|
||||
@ -140,8 +139,8 @@ cd tests
|
||||
%{_bindir}/asciidoc
|
||||
%{_bindir}/asciidoc.py
|
||||
%{_datadir}/asciidoc/
|
||||
%{python2_sitelib}/asciidocapi.py*
|
||||
%{vimdir}/ftdetect/asciidoc_filetype.vim
|
||||
%{python3_sitelib}/asciidocapi.py*
|
||||
%{python3_sitelib}/__pycache__/asciidocapi*
|
||||
%{vimdir}/syntax/asciidoc.vim
|
||||
%exclude %{_bindir}/*.py[co]
|
||||
%exclude %{_sysconfdir}/asciidoc/filters/*/*.py[co]
|
||||
@ -155,7 +154,7 @@ cd tests
|
||||
%{_pkgdocdir}/examples
|
||||
%{_pkgdocdir}/doc
|
||||
%{_pkgdocdir}/{dblatex,docbook-xsl,images,javascripts,stylesheets}
|
||||
%exclude %{_docdir}/%{name}/{BUGS,CHANGELOG,COPYING,COPYRIGHT,README}
|
||||
%exclude %{_docdir}/%{name}/{COPYING,COPYRIGHT,README.asciidoc}
|
||||
|
||||
%files latex
|
||||
%dir %{_sysconfdir}/asciidoc/filters/latex
|
||||
@ -170,6 +169,9 @@ cd tests
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Jun 05 2018 Josef Ridky <jridky@redhat.com> - 8.6.8-16.986f99d
|
||||
- New upstream version with Python3 support - asciidoc-py3 (commit 986f99d)
|
||||
|
||||
* Wed Feb 14 2018 Josef Ridky <jridky@redhat.com> - 8.6.8-15
|
||||
- spec file cleanup (remove Group tag, use autosetup)
|
||||
- add python2 build support for RHEL
|
||||
|
Loading…
Reference in New Issue
Block a user