use python3 properly in pdfbook2
This commit is contained in:
parent
35df10b12e
commit
d8e73098a3
97
texlive-base-pdfbook2-py3.patch
Normal file
97
texlive-base-pdfbook2-py3.patch
Normal file
@ -0,0 +1,97 @@
|
||||
diff -up ./scripts/pdfbook2/pdfbook2.py3 ./scripts/pdfbook2/pdfbook2
|
||||
--- ./scripts/pdfbook2/pdfbook2.py3 2016-11-25 13:32:54.000000000 -0500
|
||||
+++ ./scripts/pdfbook2/pdfbook2 2018-12-07 14:52:49.197436113 -0500
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/env python
|
||||
+#!/usr/bin/python3
|
||||
""" pdfbook2 - transform pdf files to booklets
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -29,11 +29,11 @@ import shutil
|
||||
|
||||
def booklify( name, opts ):
|
||||
#------------------------------------------------------ Check if file exists
|
||||
- print "\nProcessing", name
|
||||
+ print("\nProcessing", name)
|
||||
if not os.path.isfile( name ):
|
||||
- print "SKIP: file not found."
|
||||
+ print("SKIP: file not found.")
|
||||
return
|
||||
- print "Getting bounds...",
|
||||
+ print("Getting bounds...", end=' ')
|
||||
sys.stdout.flush()
|
||||
|
||||
#---------------------------------------------------------- useful constants
|
||||
@@ -50,8 +50,8 @@ def booklify( name, opts ):
|
||||
p.wait()
|
||||
out, err = p.communicate()
|
||||
if len( err ) != 0:
|
||||
- print err
|
||||
- print "\n\nABORT: Problem getting bounds"
|
||||
+ print(err)
|
||||
+ print("\n\nABORT: Problem getting bounds")
|
||||
sys.exit( 1 )
|
||||
lines = out.splitlines()
|
||||
bboxes = [s[len( bboxName ) + 1:] for s in lines if s.startswith( bboxName )]
|
||||
@@ -69,11 +69,11 @@ def booklify( name, opts ):
|
||||
minLOdd -= maxWidth - widthOdd
|
||||
maxREven += maxWidth - widthEven
|
||||
|
||||
- print "done"
|
||||
+ print("done")
|
||||
sys.stdout.flush()
|
||||
|
||||
#--------------------------------------------- crop file to area of interest
|
||||
- print "cropping...",
|
||||
+ print("cropping...", end=' ')
|
||||
sys.stdout.flush()
|
||||
p = subprocess.Popen( ["pdfcrop",
|
||||
"--bbox-odd", "{L} {T} {R} {B}".format( L = minLOdd - opts.innerMargin / 2,
|
||||
@@ -92,16 +92,16 @@ def booklify( name, opts ):
|
||||
p.wait()
|
||||
out, err = p.communicate()
|
||||
if len( err ) != 0:
|
||||
- print err
|
||||
- print "\n\nABORT: Problem with cropping"
|
||||
+ print(err)
|
||||
+ print("\n\nABORT: Problem with cropping")
|
||||
sys.exit( 1 )
|
||||
- print "done"
|
||||
+ print("done")
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
shutil.copy( name, tmpFile )
|
||||
|
||||
#-------------------------------------------------------- create the booklet
|
||||
- print "create booklet...",
|
||||
+ print("create booklet...", end=' ')
|
||||
sys.stdout.flush()
|
||||
pdfJamCallList = [ "pdfjam",
|
||||
"--booklet", "true",
|
||||
@@ -124,7 +124,7 @@ def booklify( name, opts ):
|
||||
p.wait()
|
||||
out, err = p.communicate()
|
||||
if len( out ) == 0:
|
||||
- print "\n\nABORT: The everyshi.sty latex package is needed for short-edge."
|
||||
+ print("\n\nABORT: The everyshi.sty latex package is needed for short-edge.")
|
||||
sys.exit( 1 )
|
||||
else:
|
||||
pdfJamCallList.append( "--preamble" )
|
||||
@@ -139,7 +139,7 @@ def booklify( name, opts ):
|
||||
#-------------------------------------------- move file and remove temp file
|
||||
os.rename( tmpFile[:-4] + "-book.pdf", name[:-4] + "-book.pdf" )
|
||||
os.remove( tmpFile )
|
||||
- print "done"
|
||||
+ print("done")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ if __name__ == "__main__":
|
||||
if len( args ) == 0:
|
||||
parser.print_version()
|
||||
parser.print_help()
|
||||
- print ""
|
||||
+ print("")
|
||||
sys.exit( 2 )
|
||||
|
||||
#------------------------------------------- run for each provided file name
|
@ -21,7 +21,7 @@
|
||||
|
||||
Name: %{shortname}-base
|
||||
Version: %{source_date}
|
||||
Release: 28%{?dist}
|
||||
Release: 29%{?dist}
|
||||
Epoch: 7
|
||||
Summary: TeX formatting system
|
||||
# The only files in the base package are directories, cache, and license texts
|
||||
@ -413,6 +413,8 @@ Patch14: texlive-base-CVE-2018-17407.patch
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1631847
|
||||
# Filed issue upstream, no resolution yet.
|
||||
Patch15: texlive-base-20180414-disable-omegafonts-check-test.patch
|
||||
# Use python3 on pdfbook2
|
||||
Patch16: texlive-base-pdfbook2-py3.patch
|
||||
|
||||
# Can't do this because it causes everything else to be noarch
|
||||
# BuildArch: noarch
|
||||
@ -6545,6 +6547,11 @@ cp -a source/texk/kpathsea/texmf.cnf %{buildroot}%{_texdir}/texmf-dist/web2c/tex
|
||||
sed -i 's|\\sc |\\scshape |g' %{buildroot}%{_texdir}/texmf-dist/bibtex/bst/base/acm.bst
|
||||
sed -i 's|\\sc |\\scshape |g' %{buildroot}%{_texdir}/texmf-dist/bibtex/bst/base/siam.bst
|
||||
|
||||
# fix pdfbook2 for py3
|
||||
pushd %{buildroot}%{_texdir}/texmf-dist
|
||||
patch -p1 < %{_sourcedir}/texlive-base-pdfbook2-py3.patch
|
||||
popd
|
||||
|
||||
# config files in /etc symlinked
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/texlive/web2c
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/texlive/dvips/config
|
||||
@ -8747,6 +8754,9 @@ done <<< "$list"
|
||||
%doc %{_texdir}/texmf-dist/doc/latex/yplan/
|
||||
|
||||
%changelog
|
||||
* Fri Dec 7 2018 Tom Callaway <spot@fedoraproject.org> - 7:20180414-29
|
||||
- use python3 properly in pdfbook2
|
||||
|
||||
* Mon Nov 26 2018 Tom Callaway <spot@fedoraproject.org> - 7:20180414-28
|
||||
- do not try to ls /usr/share/texlive/fmtutil.cnf.d, it can be empty,
|
||||
and that makes for noisy errors in scripts (bz1650935)
|
||||
|
Loading…
Reference in New Issue
Block a user