summaryrefslogtreecommitdiffstats
path: root/debian/patches/0016-Fix-python2-calls.patch
blob: 568ccd67578c42571cc906faa557f262524f734d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
Description: Build using only python 3
Author: Valentin Vidic <vvidic@debian.org>
Last-Update: 2019-08-16
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/doc/website-v1/Makefile
+++ b/doc/website-v1/Makefile
@@ -54,6 +54,7 @@
 XDGOPEN := xdg-open
 NEWS := $(wildcard news/*.adoc)
 NEWSDOC := $(patsubst %.adoc,gen/%/index.html,$(NEWS))
+PYTHON := python3
 
 .PHONY: all clean deploy open
 
@@ -62,33 +63,33 @@
 gen/index.html: index.adoc $(CRMCONF)
 	@mkdir -p $(dir $@)
 	@$(ASCIIDOC) --unsafe -b html5 -a icons -a iconsdir=/img/icons -f $(CRMCONF) -o $@ $<
-	@python ./postprocess.py -o $@ $<
+	@$(PYTHON) ./postprocess.py -o $@ $<
 
 gen/%/index.html: %.adoc $(CRMCONF)
 	@mkdir -p $(dir $@)
 	@$(ASCIIDOC) --unsafe -b html5 -a icons -a iconsdir=/img/icons -f $(CRMCONF) -o $@ $<
-	@python ./postprocess.py -o $@ $<
+	@$(PYTHON) ./postprocess.py -o $@ $<
 
 gen/history-guide/index.html: $(HISTORY_LISTINGS)
 
 gen/man/index.html: ../crm.8.adoc $(CRMCONF)
 	@mkdir -p $(dir $@)
 	@$(ASCIIDOC) --unsafe -b html5 -f $(CRMCONF) -o $@ $<
-	@python ./postprocess.py -o $@ $<
+	@$(PYTHON) ./postprocess.py -o $@ $<
 
 gen/404.html: 404.adoc $(CRMCONF)
 	@mkdir -p $(dir $@)
 	@$(ASCIIDOC) --unsafe -b html5 -f $(CRMCONF) -o $@ $<
-	@python ./postprocess.py -o $@ $<
+	@$(PYTHON) ./postprocess.py -o $@ $<
 
 news.adoc: $(NEWS) $(CRMCONF)
 	@echo "news:" $(NEWS)
-	python ./make-news.py $@ $(NEWS)
+	$(PYTHON) ./make-news.py $@ $(NEWS)
 
 gen/news/index.html: news.adoc
 	@mkdir -p $(dir $@)
 	$(ASCIIDOC) --unsafe -b html5 -f $(CRMCONF) -o $@ $<
-	@python ./postprocess.py -o $@ $<
+	@$(PYTHON) ./postprocess.py -o $@ $<
 
 gen/css/%.css: css/%.css
 	@mkdir -p gen/css
@@ -127,7 +128,7 @@
 
 gen/atom.xml: $(NEWSDOC)
 	@echo "atom:" $(NEWSDOC)
-	python ./make-news.py gen/atom.xml $(NEWS)
+	$(PYTHON) ./make-news.py gen/atom.xml $(NEWS)
 
 site: gen/atom.xml gen/index.html gen/404.html gen/news/index.html gen/man/index.html $(TGT) $(CSS) $(IMG) $(FONTS) $(NEWSDOC)
 	@which dos2unix >/dev/null && find gen -name "*.html" -type f -exec dos2unix {} \;
--- a/doc/website-v1/postprocess.py
+++ b/doc/website-v1/postprocess.py
@@ -48,7 +48,7 @@
 def generate_toc(infile, outfile, debug):
 
     if debug:
-        print "Infile:", infile
+        print("Infile:", infile)
     toc = read_toc_data(infile, debug)
     '''
     toc_data = []
@@ -57,7 +57,7 @@
         m = section.match(line)
         if m:
             if debug:
-                print "toc_data: %s" % str(((m.group('depth'), m.group('text'), m.group('id'))))
+                print("toc_data: %s" % str(((m.group('depth'), m.group('text'), m.group('id')))))
             toc_data.append((m.group('depth'), m.group('text'), m.group('id')))
 
     toc = ''
@@ -73,11 +73,11 @@
     # Write TOC to outfile
     if outfile:
         if debug:
-            print "Writing TOC:"
-            print "----"
-            print toc
-            print "----"
-            print "Outfile:", outfile
+            print("Writing TOC:")
+            print("----")
+            print(toc)
+            print("----")
+            print("Outfile:", outfile)
         fil = open(outfile)
         f = fil.readlines()
         fil.close()
@@ -96,14 +96,14 @@
         m = section.match(line)
         if m:
             if debug:
-                print "toc_data: %s" % str(((m.group('depth'), m.group('text'), m.group('id'))))
+                print("toc_data: %s" % str(((m.group('depth'), m.group('text'), m.group('id')))))
             toc_data.append((m.group('depth'), m.group('text'), m.group('id')))
 
     toc = ''
     if len(toc_data) > 0:
         toc = '<div id="toc">\n'
         for depth, text, link in toc_data:
-            if depth >= 2 and link is not None:
+            if int(depth) >= 2 and link is not None:
                 toc += '<div class="toclevel%s"><a href="#%s">%s</a></div>\n' % (
                     int(depth) - 1, link, text)
         toc += '</div>\n'
@@ -126,7 +126,7 @@
     debug = args.debug
     outfile = args.output
     infile = args.input
-    print "+ %s -> %s" % (infile, outfile)
+    print("+ %s -> %s" % (infile, outfile))
     gen = False
     for tocpage in TOC_PAGES:
         if not gen and outfile.endswith(tocpage):
--- a/doc/website-v1/make-news.py
+++ b/doc/website-v1/make-news.py
@@ -63,7 +63,7 @@
             raise ValueError("Missing date")
 
     def atom_id(self):
-        return root_id + '::' + hashlib.sha1(self.filename).hexdigest()
+        return root_id + '::' + hashlib.sha1(self.filename.encode('utf-8')).hexdigest()
 
     def atom_date(self):
         return self.date.replace(' ', 'T') + ':00' + time.tzname[0]