Skip to content

Commit f56b1bc

Browse files
committed
Port to Python 3 (including poster and wikitools)
Signed-off-by: Elsie Hupp <[email protected]>
1 parent 0cfde9e commit f56b1bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+7661
-4001
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: python
2-
python: 2.7
2+
python: 3.8
33
install:
44
- pip install tox
55
script:

.vscode/settings.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"python.analysis.extraPaths": [
3+
".",
4+
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages"
5+
],
6+
"python.pythonPath": "/usr/local/bin/python3",
7+
"restructuredtext.confPath": ""
8+
}

Pipfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
requests = "*"
8+
argparse = "*"
9+
internetarchive = "*"
10+
lxml = "*"
11+
mwclient = "*"
12+
pymysql = "*"
13+
pywikibot = "*"
14+
urllib3 = "*"
15+
tox = "*"
16+
17+
[dev-packages]
18+
nose = "*"
19+
requests = "*"
20+
21+
[requires]
22+
python_version = "3.9"

Pipfile.lock

+353
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,47 @@ This is a very quick guide for the most used features of WikiTeam tools. For fur
2727

2828
### Requirements
2929

30-
Requires <a href="https://www.python.org/downloads/release/python-278/">Python 2.7</a>.
30+
Requires <a href="https://www.python.org/downloads/release/python-278/">Python 3.9</a>.
3131

3232
Confirm you satisfy the requirements:
3333

34-
`pip install --upgrade -r requirements.txt`
34+
`pip install pipenv`
3535

3636
or, if you don't have enough permissions for the above,
3737

38-
`pip install --user --upgrade -r requirements.txt`
38+
`pip install --user pipenv`
3939

4040
### Download any wiki
4141

4242
To download any wiki, use one of the following options:
4343

44-
`python dumpgenerator.py http://wiki.domain.org --xml --images` (complete XML histories and images)
44+
`pipenv run python dumpgenerator.py http://wiki.domain.org --xml --images` (complete XML histories and images)
4545

4646
If the script can't find itself the API and/or index.php paths, then you can provide them:
4747

48-
`python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --xml --images`
48+
`pipenv run python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --xml --images`
4949

50-
`python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --index=http://wiki.domain.org/w/index.php --xml --images`
50+
`pipenv run python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --index=http://wiki.domain.org/w/index.php --xml --images`
5151

5252
If you only want the XML histories, just use `--xml`. For only the images, just `--images`. For only the current version of every page, `--xml --curonly`.
5353

5454
You can resume an aborted download:
5555

56-
`python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --xml --images --resume --path=/path/to/incomplete-dump`
56+
`pipenv run python dumpgenerator.py --api=http://wiki.domain.org/w/api.php --xml --images --resume --path=/path/to/incomplete-dump`
5757

5858
See more options:
5959

60-
`python dumpgenerator.py --help`
60+
`pipenv run python dumpgenerator.py --help`
6161

6262
### Download Wikimedia dumps
6363

6464
To download [Wikimedia XML dumps](http://dumps.wikimedia.org/backup-index.html) (Wikipedia, Wikibooks, Wikinews, etc) you can run:
6565

66-
`python wikipediadownloader.py` (download all projects)
66+
`pipenv run python wikipediadownloader.py` (download all projects)
6767

6868
See more options:
6969

70-
`python wikipediadownloader.py --help`
70+
`pipenv run python wikipediadownloader.py --help`
7171

7272
### Download Wikimedia Commons images
7373

docs/conf.py

+47-41
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
#
1919
import os
2020
import sys
21-
#sys.path.insert(0, os.path.abspath('.'))
22-
sys.path.insert(0, os.path.abspath('..'))
21+
22+
# sys.path.insert(0, os.path.abspath('.'))
23+
sys.path.insert(0, os.path.abspath(".."))
2324

2425
# -- General configuration ------------------------------------------------
2526

@@ -31,38 +32,38 @@
3132
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3233
# ones.
3334
extensions = [
34-
'sphinx.ext.autodoc',
35+
"sphinx.ext.autodoc",
3536
]
3637

3738
# Add any paths that contain templates here, relative to this directory.
38-
templates_path = ['_templates']
39+
templates_path = ["_templates"]
3940

4041
# The suffix(es) of source filenames.
4142
# You can specify multiple suffix as a list of string:
4243
#
4344
# source_suffix = ['.rst', '.md']
44-
source_suffix = '.rst'
45+
source_suffix = ".rst"
4546

4647
# The encoding of source files.
4748
#
4849
# source_encoding = 'utf-8-sig'
4950

5051
# The master toctree document.
51-
master_doc = 'index'
52+
master_doc = "index"
5253

5354
# General information about the project.
54-
project = u'WikiTeam'
55-
copyright = u'2016, WikiTeam developers'
56-
author = u'WikiTeam developers'
55+
project = u"WikiTeam"
56+
copyright = u"2016, WikiTeam developers"
57+
author = u"WikiTeam developers"
5758

5859
# The version info for the project you're documenting, acts as replacement for
5960
# |version| and |release|, also used in various other places throughout the
6061
# built documents.
6162
#
6263
# The short X.Y version.
63-
version = u'0.3'
64+
version = u"0.3"
6465
# The full version, including alpha/beta/rc tags.
65-
release = u'0.3'
66+
release = u"0.3"
6667

6768
# The language for content autogenerated by Sphinx. Refer to documentation
6869
# for a list of supported languages.
@@ -83,7 +84,7 @@
8384
# List of patterns, relative to source directory, that match files and
8485
# directories to ignore when looking for source files.
8586
# This patterns also effect to html_static_path and html_extra_path
86-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
87+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
8788

8889
# The reST default role (used for this markup: `text`) to use for all
8990
# documents.
@@ -105,7 +106,7 @@
105106
# show_authors = False
106107

107108
# The name of the Pygments (syntax highlighting) style to use.
108-
pygments_style = 'sphinx'
109+
pygments_style = "sphinx"
109110

110111
# A list of ignored prefixes for module index sorting.
111112
# modindex_common_prefix = []
@@ -122,7 +123,7 @@
122123
# The theme to use for HTML and HTML Help pages. See the documentation for
123124
# a list of builtin themes.
124125
#
125-
html_theme = 'classic'
126+
html_theme = "classic"
126127

127128
# Theme options are theme-specific and customize the look and feel of a theme
128129
# further. For a list of options available for each theme, see the
@@ -156,7 +157,7 @@
156157
# Add any paths that contain custom static files (such as style sheets) here,
157158
# relative to this directory. They are copied after the builtin static files,
158159
# so a file named "default.css" will overwrite the builtin "default.css".
159-
html_static_path = ['_static']
160+
html_static_path = ["_static"]
160161

161162
# Add any extra paths that contain custom files (such as robots.txt or
162163
# .htaccess) here, relative to this directory. These files are copied
@@ -236,34 +237,36 @@
236237
# html_search_scorer = 'scorer.js'
237238

238239
# Output file base name for HTML help builder.
239-
htmlhelp_basename = 'WikiTeamdoc'
240+
htmlhelp_basename = "WikiTeamdoc"
240241

241242
# -- Options for LaTeX output ---------------------------------------------
242243

243244
latex_elements = {
244-
# The paper size ('letterpaper' or 'a4paper').
245-
#
246-
# 'papersize': 'letterpaper',
247-
248-
# The font size ('10pt', '11pt' or '12pt').
249-
#
250-
# 'pointsize': '10pt',
251-
252-
# Additional stuff for the LaTeX preamble.
253-
#
254-
# 'preamble': '',
255-
256-
# Latex figure (float) alignment
257-
#
258-
# 'figure_align': 'htbp',
245+
# The paper size ('letterpaper' or 'a4paper').
246+
#
247+
# 'papersize': 'letterpaper',
248+
# The font size ('10pt', '11pt' or '12pt').
249+
#
250+
# 'pointsize': '10pt',
251+
# Additional stuff for the LaTeX preamble.
252+
#
253+
# 'preamble': '',
254+
# Latex figure (float) alignment
255+
#
256+
# 'figure_align': 'htbp',
259257
}
260258

261259
# Grouping the document tree into LaTeX files. List of tuples
262260
# (source start file, target name, title,
263261
# author, documentclass [howto, manual, or own class]).
264262
latex_documents = [
265-
(master_doc, 'WikiTeam.tex', u'WikiTeam Documentation',
266-
u'WikiTeam developers', 'manual'),
263+
(
264+
master_doc,
265+
"WikiTeam.tex",
266+
u"WikiTeam Documentation",
267+
u"WikiTeam developers",
268+
"manual",
269+
),
267270
]
268271

269272
# The name of an image file (relative to this directory) to place at the top of
@@ -288,7 +291,7 @@
288291
#
289292
# latex_appendices = []
290293

291-
# It false, will not define \strong, \code, itleref, \crossref ... but only
294+
# It false, will not define \strong, \code, itleref, \crossref ... but only
292295
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
293296
# packages.
294297
#
@@ -303,10 +306,7 @@
303306

304307
# One entry per manual page. List of tuples
305308
# (source start file, name, description, authors, manual section).
306-
man_pages = [
307-
(master_doc, 'wikiteam', u'WikiTeam Documentation',
308-
[author], 1)
309-
]
309+
man_pages = [(master_doc, "wikiteam", u"WikiTeam Documentation", [author], 1)]
310310

311311
# If true, show URL addresses after external links.
312312
#
@@ -319,9 +319,15 @@
319319
# (source start file, target name, title, author,
320320
# dir menu entry, description, category)
321321
texinfo_documents = [
322-
(master_doc, 'WikiTeam', u'WikiTeam Documentation',
323-
author, 'WikiTeam', 'One line description of project.',
324-
'Miscellaneous'),
322+
(
323+
master_doc,
324+
"WikiTeam",
325+
u"WikiTeam Documentation",
326+
author,
327+
"WikiTeam",
328+
"One line description of project.",
329+
"Miscellaneous",
330+
),
325331
]
326332

327333
# Documents to append as an appendix to all manuals.

0 commit comments

Comments
 (0)