Skip to content

Commit

Permalink
Port to Python 3 (including poster and wikitools)
Browse files Browse the repository at this point in the history
Signed-off-by: Elsie Hupp <9206310+elsiehupp@users.noreply.github.com>
  • Loading branch information
elsiehupp committed Jun 15, 2021
1 parent 0cfde9e commit f56b1bc
Show file tree
Hide file tree
Showing 57 changed files with 7,661 additions and 4,001 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: python
python: 2.7
python: 3.8
install:
- pip install tox
script:
Expand Down
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.analysis.extraPaths": [
".",
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages"
],
"python.pythonPath": "/usr/local/bin/python3",
"restructuredtext.confPath": ""
}
22 changes: 22 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
argparse = "*"
internetarchive = "*"
lxml = "*"
mwclient = "*"
pymysql = "*"
pywikibot = "*"
urllib3 = "*"
tox = "*"

[dev-packages]
nose = "*"
requests = "*"

[requires]
python_version = "3.9"
353 changes: 353 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,47 @@ This is a very quick guide for the most used features of WikiTeam tools. For fur

### Requirements

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

Confirm you satisfy the requirements:

`pip install --upgrade -r requirements.txt`
`pip install pipenv`

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

`pip install --user --upgrade -r requirements.txt`
`pip install --user pipenv`

### Download any wiki

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

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

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

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

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

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`.

You can resume an aborted download:

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

See more options:

`python dumpgenerator.py --help`
`pipenv run python dumpgenerator.py --help`

### Download Wikimedia dumps

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

`python wikipediadownloader.py` (download all projects)
`pipenv run python wikipediadownloader.py` (download all projects)

See more options:

`python wikipediadownloader.py --help`
`pipenv run python wikipediadownloader.py --help`

### Download Wikimedia Commons images

Expand Down
88 changes: 47 additions & 41 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#
import os
import sys
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

# sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath(".."))

# -- General configuration ------------------------------------------------

Expand All @@ -31,38 +32,38 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
"sphinx.ext.autodoc",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'WikiTeam'
copyright = u'2016, WikiTeam developers'
author = u'WikiTeam developers'
project = u"WikiTeam"
copyright = u"2016, WikiTeam developers"
author = u"WikiTeam developers"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.3'
version = u"0.3"
# The full version, including alpha/beta/rc tags.
release = u'0.3'
release = u"0.3"

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

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

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

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

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

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

# Output file base name for HTML help builder.
htmlhelp_basename = 'WikiTeamdoc'
htmlhelp_basename = "WikiTeamdoc"

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'WikiTeam.tex', u'WikiTeam Documentation',
u'WikiTeam developers', 'manual'),
(
master_doc,
"WikiTeam.tex",
u"WikiTeam Documentation",
u"WikiTeam developers",
"manual",
),
]

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

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

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'wikiteam', u'WikiTeam Documentation',
[author], 1)
]
man_pages = [(master_doc, "wikiteam", u"WikiTeam Documentation", [author], 1)]

# If true, show URL addresses after external links.
#
Expand All @@ -319,9 +319,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'WikiTeam', u'WikiTeam Documentation',
author, 'WikiTeam', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"WikiTeam",
u"WikiTeam Documentation",
author,
"WikiTeam",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand Down

0 comments on commit f56b1bc

Please sign in to comment.