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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
%global _empty_manifest_terminate_build 0
Name: python-PyRSS2Gen
Version: 1.1
Release: 1
Summary: Generate RSS2 using a Python data structure
License: BSD
URL: http://dalkescientific.com/Python/PyRSS2Gen.html
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6d/01/fd610d5fc86f7dbdbefc4baa8f7fe15a2e5484244c41dcf363ca7e89f60c/PyRSS2Gen-1.1.tar.gz
BuildArch: noarch
%description
I've finally decided to catch up with 1999 and play around a bit with
RSS. I looked around, and while there are many ways to read RSS there
are remarkably few which write them. I could use a DOM or other
construct, but I want the code to feel like Python. There are more
Pythonic APIs I might use, like the effbot's ElementTree, but I also
wanted integers, dates, and lists to be real integers, dates, and
lists. (And I want bug-eyed monsters from Alpha Centauri to be *real*
bug-eyed monsters from Alpha Centauri - is that too much I ask you?)
The RSS generators I found were built around print statements.
Workable, but they almost invariably left out proper HTML escaping the
sort which leads to Mark Pilgrim's to write feed_parser, to make sense
of documents which are neither XML nor HTML. Annoying, but sadly all
too common.
So I messed around a bit with the spec from
http://blogs.law.harvard.edu/tech/rss
The result looks like this:
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a "
"Python library for generating RSS2 feeds",
lastBuildDate = datetime.datetime.now(),
items = [
PyRSS2Gen.RSSItem(
title = "PyRSS2Gen-0.0 released",
link = "http://www.dalkescientific.com/news/030906-PyRSS2Gen.html",
description = "Dalke Scientific today announced PyRSS2Gen-0.0, "
"a library for generating RSS feeds for Python. ",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/news/"
"030906-PyRSS2Gen.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 31)),
PyRSS2Gen.RSSItem(
title = "Thoughts on RSS feeds for bioinformatics",
link = "http://www.dalkescientific.com/writings/diary/"
"archive/2003/09/06/RSS.html",
description = "One of the reasons I wrote PyRSS2Gen was to "
"experiment with RSS for data collection in "
"bioinformatics. Last year I came across...",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/writings/"
"diary/archive/2003/09/06/RSS.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 49)),
])
rss.write_xml(open("pyrss2gen.xml", "w"))
The output does not contain newlines, so if you want to read it,
you'll need to use your favorite XML tools to reformat it.
RSS is not a fixed format. People are free to add various metadata,
like Dublin Core elements.
The RSS objects are converted to XML using the 'publish' method, which
takes a SAX2 ContentHandler. If you want different output, implement
your own 'publish'. The "simple" data types which takes a string,
int, or date, can be replaced with a publishable object, so you can
add metadata to, say, the "description" field. To support new
elements for RSS and RSSItem, derive from them and use the
'publish_extensions" hook. To add your own attributes (needed for
namespace declarations), redefine 'element_attrs' or 'rss_attrs' in
your subclass.
To use a different encoding, create your own ContentHandler instead of
using the helper methods 'to_xml' and 'write_xml.' You'll need to
make sure the 'characters' method in the handler does the appropriate
translation.
The "categories" list is somewhat special. It needs to be a list and
doesn't have a publish method. That's because the RSS spec doesn't
have an explicit concept for the set of categories -- an RSS2 channel
can have 0 or more 'category' elements, but doesn't have a "list of
categories" -- my "categories" attribute is an API fiction.
BUGS:
Several people have used this package since its first release in
September of 2003 and reported a couple of bugs. All those are fixed.
There are no known bugs.
The name PyRSS2Gen is a mouthful. It didn't think it was useful to
come up with a cute name. You might consider having
import PyRSS2Gen as RSS2
in any code which uses this module. I'm not changing the name because
anyone who reads "RSS2" will likely think it's a parser and not a
generator. Plus, the current name is very easy to find via a web
search.
LICENSE:
This is copyright (c) by Andrew Dalke Scientific, AB (previously
'Dalke Scientific Software, LLC') and released under the BSD
license. See the file LICENSE in the distribution, or
http://www.opensource.org/licenses/bsd-license.php
for details.
CHANGES for 1.1: Released August 25, 2012
- Ported to Python 3.x. Thanks to Graham Bell for the initial patch.
CHANGES for 1.0: Released November 6, 2005
- Many people (Richard Chamberlain, Daniel Hsu, Leonart Richardson
and Daniel Holth) pointed out that Guid sets "isPermaLink" (with a
"L" not "l"). Fixed, and changed it so the isPermaLink RSS attribute
is always either "true" or "false" instead of assuming empty means false.
- Added patches from Erik de Jonge and MATSUNO Tokuhiro to set the
output encoding.
- Implemented a suggestion by Daniel Hoth to convert the enclosure
length to a string.
CHANGES for 0.1.1: Released in September 2003
- retroactively renamed "0.0" to "0.1"
- fixed bug in Image height. Patch thanks to Edward Dale.
%package -n python3-PyRSS2Gen
Summary: Generate RSS2 using a Python data structure
Provides: python-PyRSS2Gen
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-PyRSS2Gen
I've finally decided to catch up with 1999 and play around a bit with
RSS. I looked around, and while there are many ways to read RSS there
are remarkably few which write them. I could use a DOM or other
construct, but I want the code to feel like Python. There are more
Pythonic APIs I might use, like the effbot's ElementTree, but I also
wanted integers, dates, and lists to be real integers, dates, and
lists. (And I want bug-eyed monsters from Alpha Centauri to be *real*
bug-eyed monsters from Alpha Centauri - is that too much I ask you?)
The RSS generators I found were built around print statements.
Workable, but they almost invariably left out proper HTML escaping the
sort which leads to Mark Pilgrim's to write feed_parser, to make sense
of documents which are neither XML nor HTML. Annoying, but sadly all
too common.
So I messed around a bit with the spec from
http://blogs.law.harvard.edu/tech/rss
The result looks like this:
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a "
"Python library for generating RSS2 feeds",
lastBuildDate = datetime.datetime.now(),
items = [
PyRSS2Gen.RSSItem(
title = "PyRSS2Gen-0.0 released",
link = "http://www.dalkescientific.com/news/030906-PyRSS2Gen.html",
description = "Dalke Scientific today announced PyRSS2Gen-0.0, "
"a library for generating RSS feeds for Python. ",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/news/"
"030906-PyRSS2Gen.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 31)),
PyRSS2Gen.RSSItem(
title = "Thoughts on RSS feeds for bioinformatics",
link = "http://www.dalkescientific.com/writings/diary/"
"archive/2003/09/06/RSS.html",
description = "One of the reasons I wrote PyRSS2Gen was to "
"experiment with RSS for data collection in "
"bioinformatics. Last year I came across...",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/writings/"
"diary/archive/2003/09/06/RSS.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 49)),
])
rss.write_xml(open("pyrss2gen.xml", "w"))
The output does not contain newlines, so if you want to read it,
you'll need to use your favorite XML tools to reformat it.
RSS is not a fixed format. People are free to add various metadata,
like Dublin Core elements.
The RSS objects are converted to XML using the 'publish' method, which
takes a SAX2 ContentHandler. If you want different output, implement
your own 'publish'. The "simple" data types which takes a string,
int, or date, can be replaced with a publishable object, so you can
add metadata to, say, the "description" field. To support new
elements for RSS and RSSItem, derive from them and use the
'publish_extensions" hook. To add your own attributes (needed for
namespace declarations), redefine 'element_attrs' or 'rss_attrs' in
your subclass.
To use a different encoding, create your own ContentHandler instead of
using the helper methods 'to_xml' and 'write_xml.' You'll need to
make sure the 'characters' method in the handler does the appropriate
translation.
The "categories" list is somewhat special. It needs to be a list and
doesn't have a publish method. That's because the RSS spec doesn't
have an explicit concept for the set of categories -- an RSS2 channel
can have 0 or more 'category' elements, but doesn't have a "list of
categories" -- my "categories" attribute is an API fiction.
BUGS:
Several people have used this package since its first release in
September of 2003 and reported a couple of bugs. All those are fixed.
There are no known bugs.
The name PyRSS2Gen is a mouthful. It didn't think it was useful to
come up with a cute name. You might consider having
import PyRSS2Gen as RSS2
in any code which uses this module. I'm not changing the name because
anyone who reads "RSS2" will likely think it's a parser and not a
generator. Plus, the current name is very easy to find via a web
search.
LICENSE:
This is copyright (c) by Andrew Dalke Scientific, AB (previously
'Dalke Scientific Software, LLC') and released under the BSD
license. See the file LICENSE in the distribution, or
http://www.opensource.org/licenses/bsd-license.php
for details.
CHANGES for 1.1: Released August 25, 2012
- Ported to Python 3.x. Thanks to Graham Bell for the initial patch.
CHANGES for 1.0: Released November 6, 2005
- Many people (Richard Chamberlain, Daniel Hsu, Leonart Richardson
and Daniel Holth) pointed out that Guid sets "isPermaLink" (with a
"L" not "l"). Fixed, and changed it so the isPermaLink RSS attribute
is always either "true" or "false" instead of assuming empty means false.
- Added patches from Erik de Jonge and MATSUNO Tokuhiro to set the
output encoding.
- Implemented a suggestion by Daniel Hoth to convert the enclosure
length to a string.
CHANGES for 0.1.1: Released in September 2003
- retroactively renamed "0.0" to "0.1"
- fixed bug in Image height. Patch thanks to Edward Dale.
%package help
Summary: Development documents and examples for PyRSS2Gen
Provides: python3-PyRSS2Gen-doc
%description help
I've finally decided to catch up with 1999 and play around a bit with
RSS. I looked around, and while there are many ways to read RSS there
are remarkably few which write them. I could use a DOM or other
construct, but I want the code to feel like Python. There are more
Pythonic APIs I might use, like the effbot's ElementTree, but I also
wanted integers, dates, and lists to be real integers, dates, and
lists. (And I want bug-eyed monsters from Alpha Centauri to be *real*
bug-eyed monsters from Alpha Centauri - is that too much I ask you?)
The RSS generators I found were built around print statements.
Workable, but they almost invariably left out proper HTML escaping the
sort which leads to Mark Pilgrim's to write feed_parser, to make sense
of documents which are neither XML nor HTML. Annoying, but sadly all
too common.
So I messed around a bit with the spec from
http://blogs.law.harvard.edu/tech/rss
The result looks like this:
import datetime
import PyRSS2Gen
rss = PyRSS2Gen.RSS2(
title = "Andrew's PyRSS2Gen feed",
link = "http://www.dalkescientific.com/Python/PyRSS2Gen.html",
description = "The latest news about PyRSS2Gen, a "
"Python library for generating RSS2 feeds",
lastBuildDate = datetime.datetime.now(),
items = [
PyRSS2Gen.RSSItem(
title = "PyRSS2Gen-0.0 released",
link = "http://www.dalkescientific.com/news/030906-PyRSS2Gen.html",
description = "Dalke Scientific today announced PyRSS2Gen-0.0, "
"a library for generating RSS feeds for Python. ",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/news/"
"030906-PyRSS2Gen.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 31)),
PyRSS2Gen.RSSItem(
title = "Thoughts on RSS feeds for bioinformatics",
link = "http://www.dalkescientific.com/writings/diary/"
"archive/2003/09/06/RSS.html",
description = "One of the reasons I wrote PyRSS2Gen was to "
"experiment with RSS for data collection in "
"bioinformatics. Last year I came across...",
guid = PyRSS2Gen.Guid("http://www.dalkescientific.com/writings/"
"diary/archive/2003/09/06/RSS.html"),
pubDate = datetime.datetime(2003, 9, 6, 21, 49)),
])
rss.write_xml(open("pyrss2gen.xml", "w"))
The output does not contain newlines, so if you want to read it,
you'll need to use your favorite XML tools to reformat it.
RSS is not a fixed format. People are free to add various metadata,
like Dublin Core elements.
The RSS objects are converted to XML using the 'publish' method, which
takes a SAX2 ContentHandler. If you want different output, implement
your own 'publish'. The "simple" data types which takes a string,
int, or date, can be replaced with a publishable object, so you can
add metadata to, say, the "description" field. To support new
elements for RSS and RSSItem, derive from them and use the
'publish_extensions" hook. To add your own attributes (needed for
namespace declarations), redefine 'element_attrs' or 'rss_attrs' in
your subclass.
To use a different encoding, create your own ContentHandler instead of
using the helper methods 'to_xml' and 'write_xml.' You'll need to
make sure the 'characters' method in the handler does the appropriate
translation.
The "categories" list is somewhat special. It needs to be a list and
doesn't have a publish method. That's because the RSS spec doesn't
have an explicit concept for the set of categories -- an RSS2 channel
can have 0 or more 'category' elements, but doesn't have a "list of
categories" -- my "categories" attribute is an API fiction.
BUGS:
Several people have used this package since its first release in
September of 2003 and reported a couple of bugs. All those are fixed.
There are no known bugs.
The name PyRSS2Gen is a mouthful. It didn't think it was useful to
come up with a cute name. You might consider having
import PyRSS2Gen as RSS2
in any code which uses this module. I'm not changing the name because
anyone who reads "RSS2" will likely think it's a parser and not a
generator. Plus, the current name is very easy to find via a web
search.
LICENSE:
This is copyright (c) by Andrew Dalke Scientific, AB (previously
'Dalke Scientific Software, LLC') and released under the BSD
license. See the file LICENSE in the distribution, or
http://www.opensource.org/licenses/bsd-license.php
for details.
CHANGES for 1.1: Released August 25, 2012
- Ported to Python 3.x. Thanks to Graham Bell for the initial patch.
CHANGES for 1.0: Released November 6, 2005
- Many people (Richard Chamberlain, Daniel Hsu, Leonart Richardson
and Daniel Holth) pointed out that Guid sets "isPermaLink" (with a
"L" not "l"). Fixed, and changed it so the isPermaLink RSS attribute
is always either "true" or "false" instead of assuming empty means false.
- Added patches from Erik de Jonge and MATSUNO Tokuhiro to set the
output encoding.
- Implemented a suggestion by Daniel Hoth to convert the enclosure
length to a string.
CHANGES for 0.1.1: Released in September 2003
- retroactively renamed "0.0" to "0.1"
- fixed bug in Image height. Patch thanks to Edward Dale.
%prep
%autosetup -n PyRSS2Gen-1.1
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-PyRSS2Gen -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Fri Apr 21 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1-1
- Package Spec generated
|