mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1437593 - Vendor pathlib 1.0.1; r=ted
MozReview-Commit-ID: 1K4kCgbVmxZ --HG-- extra : rebase_source : 10f8b49f3627a39c26ecd91e3086455c912b7c0c
This commit is contained in:
parent
116887fa36
commit
3dfa291a79
19
third_party/python/pathlib/LICENSE.txt
vendored
Normal file
19
third_party/python/pathlib/LICENSE.txt
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2012-2014 Antoine Pitrou and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
177
third_party/python/pathlib/PKG-INFO
vendored
Normal file
177
third_party/python/pathlib/PKG-INFO
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
Metadata-Version: 1.1
|
||||
Name: pathlib
|
||||
Version: 1.0.1
|
||||
Summary: Object-oriented filesystem paths
|
||||
Home-page: https://pathlib.readthedocs.org/
|
||||
Author: Antoine Pitrou
|
||||
Author-email: solipsis@pitrou.net
|
||||
License: MIT License
|
||||
Download-URL: https://pypi.python.org/pypi/pathlib/
|
||||
Description: pathlib offers a set of classes to handle filesystem paths. It offers the
|
||||
following advantages over using string objects:
|
||||
|
||||
* No more cumbersome use of os and os.path functions. Everything can be
|
||||
done easily through operators, attribute accesses, and method calls.
|
||||
|
||||
* Embodies the semantics of different path types. For example, comparing
|
||||
Windows paths ignores casing.
|
||||
|
||||
* Well-defined semantics, eliminating any warts or ambiguities (forward vs.
|
||||
backward slashes, etc.).
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Python 3.2 or later is recommended, but pathlib is also usable with Python 2.7
|
||||
and 2.6.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
In Python 3.4, pathlib is now part of the standard library. For Python 3.3
|
||||
and earlier, ``easy_install pathlib`` or ``pip install pathlib`` should do
|
||||
the trick.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Importing the module classes::
|
||||
|
||||
>>> from pathlib import *
|
||||
|
||||
Listing Python source files in a directory::
|
||||
|
||||
>>> list(p.glob('*.py'))
|
||||
[PosixPath('test_pathlib.py'), PosixPath('setup.py'),
|
||||
PosixPath('pathlib.py')]
|
||||
|
||||
Navigating inside a directory tree::
|
||||
|
||||
>>> p = Path('/etc')
|
||||
>>> q = p / 'init.d' / 'reboot'
|
||||
>>> q
|
||||
PosixPath('/etc/init.d/reboot')
|
||||
>>> q.resolve()
|
||||
PosixPath('/etc/rc.d/init.d/halt')
|
||||
|
||||
Querying path properties::
|
||||
|
||||
>>> q.exists()
|
||||
True
|
||||
>>> q.is_dir()
|
||||
False
|
||||
|
||||
Opening a file::
|
||||
|
||||
>>> with q.open() as f: f.readline()
|
||||
...
|
||||
'#!/bin/bash\n'
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
The full documentation can be read at `Read the Docs
|
||||
<https://pathlib.readthedocs.org/>`_.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Main development now takes place in the Python standard library: see
|
||||
the `Python developer's guide <http://docs.python.org/devguide/>`_, and
|
||||
report issues on the `Python bug tracker <http://bugs.python.org/>`_.
|
||||
|
||||
However, if you find an issue specific to prior versions of Python
|
||||
(such as 2.7 or 3.2), you can post an issue on the
|
||||
`BitBucket project page <https://bitbucket.org/pitrou/pathlib/>`_.
|
||||
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Version 1.0.1
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
- Pull requestion #4: Python 2.6 compatibility by eevee.
|
||||
|
||||
Version 1.0
|
||||
^^^^^^^^^^^
|
||||
|
||||
This version brings ``pathlib`` up to date with the official Python 3.4
|
||||
release, and also fixes a couple of 2.7-specific issues.
|
||||
|
||||
- Python issue #20765: Add missing documentation for PurePath.with_name()
|
||||
and PurePath.with_suffix().
|
||||
- Fix test_mkdir_parents when the working directory has additional bits
|
||||
set (such as the setgid or sticky bits).
|
||||
- Python issue #20111: pathlib.Path.with_suffix() now sanity checks the
|
||||
given suffix.
|
||||
- Python issue #19918: Fix PurePath.relative_to() under Windows.
|
||||
- Python issue #19921: When Path.mkdir() is called with parents=True, any
|
||||
missing parent is created with the default permissions, ignoring the mode
|
||||
argument (mimicking the POSIX "mkdir -p" command).
|
||||
- Python issue #19887: Improve the Path.resolve() algorithm to support
|
||||
certain symlink chains.
|
||||
- Make pathlib usable under Python 2.7 with unicode pathnames (only pure
|
||||
ASCII, though).
|
||||
- Issue #21: fix TypeError under Python 2.7 when using new division.
|
||||
- Add tox support for easier testing.
|
||||
|
||||
Version 0.97
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This version brings ``pathlib`` up to date with the final API specified
|
||||
in :pep:`428`. The changes are too long to list here, it is recommended
|
||||
to read the `documentation <https://pathlib.readthedocs.org/>`_.
|
||||
|
||||
.. warning::
|
||||
The API in this version is partially incompatible with pathlib 0.8 and
|
||||
earlier. Be sure to check your code for possible breakage!
|
||||
|
||||
Version 0.8
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add PurePath.name and PurePath.anchor.
|
||||
- Add Path.owner and Path.group.
|
||||
- Add Path.replace().
|
||||
- Add Path.as_uri().
|
||||
- Issue #10: when creating a file with Path.open(), don't set the executable
|
||||
bit.
|
||||
- Issue #11: fix comparisons with non-Path objects.
|
||||
|
||||
Version 0.7
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add '**' (recursive) patterns to Path.glob().
|
||||
- Fix openat() support after the API refactoring in Python 3.3 beta1.
|
||||
- Add a *target_is_directory* argument to Path.symlink_to()
|
||||
|
||||
Version 0.6
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add Path.is_file() and Path.is_symlink()
|
||||
- Add Path.glob() and Path.rglob()
|
||||
- Add PurePath.match()
|
||||
|
||||
Version 0.5
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add Path.mkdir().
|
||||
- Add Python 2.7 compatibility by Michele Lacchia.
|
||||
- Make parent() raise ValueError when the level is greater than the path
|
||||
length.
|
||||
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 2.6
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3.2
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Topic :: Software Development :: Libraries
|
||||
Classifier: Topic :: System :: Filesystems
|
154
third_party/python/pathlib/README.txt
vendored
Normal file
154
third_party/python/pathlib/README.txt
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
pathlib offers a set of classes to handle filesystem paths. It offers the
|
||||
following advantages over using string objects:
|
||||
|
||||
* No more cumbersome use of os and os.path functions. Everything can be
|
||||
done easily through operators, attribute accesses, and method calls.
|
||||
|
||||
* Embodies the semantics of different path types. For example, comparing
|
||||
Windows paths ignores casing.
|
||||
|
||||
* Well-defined semantics, eliminating any warts or ambiguities (forward vs.
|
||||
backward slashes, etc.).
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Python 3.2 or later is recommended, but pathlib is also usable with Python 2.7
|
||||
and 2.6.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
In Python 3.4, pathlib is now part of the standard library. For Python 3.3
|
||||
and earlier, ``easy_install pathlib`` or ``pip install pathlib`` should do
|
||||
the trick.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Importing the module classes::
|
||||
|
||||
>>> from pathlib import *
|
||||
|
||||
Listing Python source files in a directory::
|
||||
|
||||
>>> list(p.glob('*.py'))
|
||||
[PosixPath('test_pathlib.py'), PosixPath('setup.py'),
|
||||
PosixPath('pathlib.py')]
|
||||
|
||||
Navigating inside a directory tree::
|
||||
|
||||
>>> p = Path('/etc')
|
||||
>>> q = p / 'init.d' / 'reboot'
|
||||
>>> q
|
||||
PosixPath('/etc/init.d/reboot')
|
||||
>>> q.resolve()
|
||||
PosixPath('/etc/rc.d/init.d/halt')
|
||||
|
||||
Querying path properties::
|
||||
|
||||
>>> q.exists()
|
||||
True
|
||||
>>> q.is_dir()
|
||||
False
|
||||
|
||||
Opening a file::
|
||||
|
||||
>>> with q.open() as f: f.readline()
|
||||
...
|
||||
'#!/bin/bash\n'
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
The full documentation can be read at `Read the Docs
|
||||
<https://pathlib.readthedocs.org/>`_.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Main development now takes place in the Python standard library: see
|
||||
the `Python developer's guide <http://docs.python.org/devguide/>`_, and
|
||||
report issues on the `Python bug tracker <http://bugs.python.org/>`_.
|
||||
|
||||
However, if you find an issue specific to prior versions of Python
|
||||
(such as 2.7 or 3.2), you can post an issue on the
|
||||
`BitBucket project page <https://bitbucket.org/pitrou/pathlib/>`_.
|
||||
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Version 1.0.1
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
- Pull requestion #4: Python 2.6 compatibility by eevee.
|
||||
|
||||
Version 1.0
|
||||
^^^^^^^^^^^
|
||||
|
||||
This version brings ``pathlib`` up to date with the official Python 3.4
|
||||
release, and also fixes a couple of 2.7-specific issues.
|
||||
|
||||
- Python issue #20765: Add missing documentation for PurePath.with_name()
|
||||
and PurePath.with_suffix().
|
||||
- Fix test_mkdir_parents when the working directory has additional bits
|
||||
set (such as the setgid or sticky bits).
|
||||
- Python issue #20111: pathlib.Path.with_suffix() now sanity checks the
|
||||
given suffix.
|
||||
- Python issue #19918: Fix PurePath.relative_to() under Windows.
|
||||
- Python issue #19921: When Path.mkdir() is called with parents=True, any
|
||||
missing parent is created with the default permissions, ignoring the mode
|
||||
argument (mimicking the POSIX "mkdir -p" command).
|
||||
- Python issue #19887: Improve the Path.resolve() algorithm to support
|
||||
certain symlink chains.
|
||||
- Make pathlib usable under Python 2.7 with unicode pathnames (only pure
|
||||
ASCII, though).
|
||||
- Issue #21: fix TypeError under Python 2.7 when using new division.
|
||||
- Add tox support for easier testing.
|
||||
|
||||
Version 0.97
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This version brings ``pathlib`` up to date with the final API specified
|
||||
in :pep:`428`. The changes are too long to list here, it is recommended
|
||||
to read the `documentation <https://pathlib.readthedocs.org/>`_.
|
||||
|
||||
.. warning::
|
||||
The API in this version is partially incompatible with pathlib 0.8 and
|
||||
earlier. Be sure to check your code for possible breakage!
|
||||
|
||||
Version 0.8
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add PurePath.name and PurePath.anchor.
|
||||
- Add Path.owner and Path.group.
|
||||
- Add Path.replace().
|
||||
- Add Path.as_uri().
|
||||
- Issue #10: when creating a file with Path.open(), don't set the executable
|
||||
bit.
|
||||
- Issue #11: fix comparisons with non-Path objects.
|
||||
|
||||
Version 0.7
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add '**' (recursive) patterns to Path.glob().
|
||||
- Fix openat() support after the API refactoring in Python 3.3 beta1.
|
||||
- Add a *target_is_directory* argument to Path.symlink_to()
|
||||
|
||||
Version 0.6
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add Path.is_file() and Path.is_symlink()
|
||||
- Add Path.glob() and Path.rglob()
|
||||
- Add PurePath.match()
|
||||
|
||||
Version 0.5
|
||||
^^^^^^^^^^^
|
||||
|
||||
- Add Path.mkdir().
|
||||
- Add Python 2.7 compatibility by Michele Lacchia.
|
||||
- Make parent() raise ValueError when the level is greater than the path
|
||||
length.
|
1
third_party/python/pathlib/VERSION.txt
vendored
Normal file
1
third_party/python/pathlib/VERSION.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
1.0.1
|
153
third_party/python/pathlib/docs/Makefile
vendored
Normal file
153
third_party/python/pathlib/docs/Makefile
vendored
Normal file
@ -0,0 +1,153 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pathlib.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pathlib.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/pathlib"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pathlib"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
245
third_party/python/pathlib/docs/conf.py
vendored
Normal file
245
third_party/python/pathlib/docs/conf.py
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# pathlib documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Jan 29 23:31:18 2012.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration -----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = []
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'pathlib'
|
||||
copyright = '2012, Antoine Pitrou'
|
||||
|
||||
# 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 = open(os.path.join(
|
||||
os.path.dirname(os.path.dirname(__file__)),
|
||||
'VERSION.txt')).read().strip()
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = ['_build']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#html_theme = 'default'
|
||||
|
||||
# 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
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# 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']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'pathlibdoc'
|
||||
|
||||
|
||||
# -- 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': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'pathlib.tex', 'pathlib Documentation',
|
||||
'Antoine Pitrou', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output --------------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'pathlib', 'pathlib Documentation',
|
||||
['Antoine Pitrou'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output ------------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'pathlib', 'pathlib Documentation',
|
||||
'Antoine Pitrou', 'pathlib', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
931
third_party/python/pathlib/docs/index.rst
vendored
Normal file
931
third_party/python/pathlib/docs/index.rst
vendored
Normal file
@ -0,0 +1,931 @@
|
||||
|
||||
pathlib
|
||||
=======
|
||||
|
||||
.. module:: pathlib
|
||||
:synopsis: Object-oriented filesystem paths
|
||||
|
||||
.. moduleauthor:: Antoine Pitrou <solipsis@pitrou.net>
|
||||
|
||||
|
||||
Manipulating filesystem paths as string objects can quickly become cumbersome:
|
||||
multiple calls to :func:`os.path.join` or :func:`os.path.dirname`, etc.
|
||||
This module offers a set of classes featuring all the common operations on
|
||||
paths in an easy, object-oriented way.
|
||||
|
||||
This module is best used with Python 3.2 or later, but it is also compatible
|
||||
with Python 2.7.
|
||||
|
||||
.. note::
|
||||
This module has been `included <http://docs.python.org/dev/library/pathlib.html>`_
|
||||
in the Python 3.4 standard library after :pep:`428` acceptance. You only
|
||||
need to install it for Python 3.3 or older.
|
||||
|
||||
.. seealso::
|
||||
:pep:`428`: Rationale for the final pathlib design and API.
|
||||
|
||||
Download
|
||||
--------
|
||||
|
||||
Standalone releases are available on PyPI: http://pypi.python.org/pypi/pathlib/
|
||||
|
||||
Main development now takes place in the Python standard library: see
|
||||
the `Python developer's guide <http://docs.python.org/devguide/>`_.
|
||||
|
||||
The maintenance repository for this standalone backport module can be
|
||||
found on BitBucket, but activity is expected to be quite low:
|
||||
https://bitbucket.org/pitrou/pathlib/
|
||||
|
||||
|
||||
High-level view
|
||||
---------------
|
||||
|
||||
This module offers classes representing filesystem paths with semantics
|
||||
appropriate for different operating systems. Path classes are divided
|
||||
between :ref:`pure paths <pure-paths>`, which provide purely computational
|
||||
operations without I/O, and :ref:`concrete paths <concrete-paths>`, which
|
||||
inherit from pure paths but also provide I/O operations.
|
||||
|
||||
.. image:: pathlib-inheritance.png
|
||||
:align: center
|
||||
|
||||
If you've never used this module before or just aren't sure which class is
|
||||
right for your task, :class:`Path` is most likely what you need. It instantiates
|
||||
a :ref:`concrete path <concrete-paths>` for the platform the code is running on.
|
||||
|
||||
Pure paths are useful in some special cases; for example:
|
||||
|
||||
#. If you want to manipulate Windows paths on a Unix machine (or vice versa).
|
||||
You cannot instantiate a :class:`WindowsPath` when running on Unix, but you
|
||||
can instantiate :class:`PureWindowsPath`.
|
||||
#. You want to make sure that your code only manipulates paths without actually
|
||||
accessing the OS. In this case, instantiating one of the pure classes may be
|
||||
useful since those simply don't have any OS-accessing operations.
|
||||
|
||||
|
||||
Basic use
|
||||
---------
|
||||
|
||||
Importing the module classes::
|
||||
|
||||
>>> from pathlib import *
|
||||
|
||||
Listing subdirectories::
|
||||
|
||||
>>> p = Path('.')
|
||||
>>> [x for x in p.iterdir() if x.is_dir()]
|
||||
[PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),
|
||||
PosixPath('__pycache__'), PosixPath('build')]
|
||||
|
||||
Listing Python source files in this directory tree::
|
||||
|
||||
>>> list(p.glob('**/*.py'))
|
||||
[PosixPath('test_pathlib.py'), PosixPath('setup.py'),
|
||||
PosixPath('pathlib.py'), PosixPath('docs/conf.py'),
|
||||
PosixPath('build/lib/pathlib.py')]
|
||||
|
||||
Navigating inside a directory tree::
|
||||
|
||||
>>> p = Path('/etc')
|
||||
>>> q = p / 'init.d' / 'reboot'
|
||||
>>> q
|
||||
PosixPath('/etc/init.d/reboot')
|
||||
>>> q.resolve()
|
||||
PosixPath('/etc/rc.d/init.d/halt')
|
||||
|
||||
Querying path properties::
|
||||
|
||||
>>> q.exists()
|
||||
True
|
||||
>>> q.is_dir()
|
||||
False
|
||||
|
||||
Opening a file::
|
||||
|
||||
>>> with q.open() as f: f.readline()
|
||||
...
|
||||
'#!/bin/bash\n'
|
||||
|
||||
|
||||
.. _pure-paths:
|
||||
|
||||
Pure paths
|
||||
----------
|
||||
|
||||
Pure path objects provide path-handling operations which don't actually
|
||||
access a filesystem. There are three ways to access these classes, which
|
||||
we also call *flavours*:
|
||||
|
||||
.. class:: PurePath(*pathsegments)
|
||||
|
||||
A generic class that represents the system's path flavour (instantiating
|
||||
it creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::
|
||||
|
||||
>>> PurePath('setup.py') # Running on a Unix machine
|
||||
PurePosixPath('setup.py')
|
||||
|
||||
Each element of *pathsegments* can be either a string or bytes object
|
||||
representing a path segment; it can also be another path object::
|
||||
|
||||
>>> PurePath('foo', 'some/path', 'bar')
|
||||
PurePosixPath('foo/some/path/bar')
|
||||
>>> PurePath(Path('foo'), Path('bar'))
|
||||
PurePosixPath('foo/bar')
|
||||
|
||||
When *pathsegments* is empty, the current directory is assumed::
|
||||
|
||||
>>> PurePath()
|
||||
PurePosixPath('.')
|
||||
|
||||
When several absolute paths are given, the last is taken as an anchor
|
||||
(mimicking :func:`os.path.join`'s behaviour)::
|
||||
|
||||
>>> PurePath('/etc', '/usr', 'lib64')
|
||||
PurePosixPath('/usr/lib64')
|
||||
>>> PureWindowsPath('c:/Windows', 'd:bar')
|
||||
PureWindowsPath('d:bar')
|
||||
|
||||
However, in a Windows path, changing the local root doesn't discard the
|
||||
previous drive setting::
|
||||
|
||||
>>> PureWindowsPath('c:/Windows', '/Program Files')
|
||||
PureWindowsPath('c:/Program Files')
|
||||
|
||||
Spurious slashes and single dots are collapsed, but double dots (``'..'``)
|
||||
are not, since this would change the meaning of a path in the face of
|
||||
symbolic links::
|
||||
|
||||
>>> PurePath('foo//bar')
|
||||
PurePosixPath('foo/bar')
|
||||
>>> PurePath('foo/./bar')
|
||||
PurePosixPath('foo/bar')
|
||||
>>> PurePath('foo/../bar')
|
||||
PurePosixPath('foo/../bar')
|
||||
|
||||
(a naïve approach would make ``PurePosixPath('foo/../bar')`` equivalent
|
||||
to ``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link
|
||||
to another directory)
|
||||
|
||||
.. class:: PurePosixPath(*pathsegments)
|
||||
|
||||
A subclass of :class:`PurePath`, this path flavour represents non-Windows
|
||||
filesystem paths::
|
||||
|
||||
>>> PurePosixPath('/etc')
|
||||
PurePosixPath('/etc')
|
||||
|
||||
*pathsegments* is specified similarly to :class:`PurePath`.
|
||||
|
||||
.. class:: PureWindowsPath(*pathsegments)
|
||||
|
||||
A subclass of :class:`PurePath`, this path flavour represents Windows
|
||||
filesystem paths::
|
||||
|
||||
>>> PureWindowsPath('c:/Program Files/')
|
||||
PureWindowsPath('c:/Program Files')
|
||||
|
||||
*pathsegments* is specified similarly to :class:`PurePath`.
|
||||
|
||||
Regardless of the system you're running on, you can instantiate all of
|
||||
these classes, since they don't provide any operation that does system calls.
|
||||
|
||||
|
||||
General properties
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Paths are immutable and hashable. Paths of a same flavour are comparable
|
||||
and orderable. These properties respect the flavour's case-folding
|
||||
semantics::
|
||||
|
||||
>>> PurePosixPath('foo') == PurePosixPath('FOO')
|
||||
False
|
||||
>>> PureWindowsPath('foo') == PureWindowsPath('FOO')
|
||||
True
|
||||
>>> PureWindowsPath('FOO') in { PureWindowsPath('foo') }
|
||||
True
|
||||
>>> PureWindowsPath('C:') < PureWindowsPath('d:')
|
||||
True
|
||||
|
||||
Paths of a different flavour compare unequal and cannot be ordered::
|
||||
|
||||
>>> PureWindowsPath('foo') == PurePosixPath('foo')
|
||||
False
|
||||
>>> PureWindowsPath('foo') < PurePosixPath('foo')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
TypeError: unorderable types: PureWindowsPath() < PurePosixPath()
|
||||
|
||||
|
||||
Operators
|
||||
^^^^^^^^^
|
||||
|
||||
The slash operator helps create child paths, similarly to ``os.path.join``::
|
||||
|
||||
>>> p = PurePath('/etc')
|
||||
>>> p
|
||||
PurePosixPath('/etc')
|
||||
>>> p / 'init.d' / 'apache2'
|
||||
PurePosixPath('/etc/init.d/apache2')
|
||||
>>> q = PurePath('bin')
|
||||
>>> '/usr' / q
|
||||
PurePosixPath('/usr/bin')
|
||||
|
||||
The string representation of a path is the raw filesystem path itself
|
||||
(in native form, e.g. with backslashes under Windows), which you can
|
||||
pass to any function taking a file path as a string::
|
||||
|
||||
>>> p = PurePath('/etc')
|
||||
>>> str(p)
|
||||
'/etc'
|
||||
>>> p = PureWindowsPath('c:/Program Files')
|
||||
>>> str(p)
|
||||
'c:\\Program Files'
|
||||
|
||||
Similarly, calling ``bytes`` on a path gives the raw filesystem path as a
|
||||
bytes object, as encoded by ``os.fsencode``::
|
||||
|
||||
>>> bytes(p)
|
||||
b'/etc'
|
||||
|
||||
|
||||
Accessing individual parts
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To access the individual "parts" (components) of a path, use the following
|
||||
property:
|
||||
|
||||
.. data:: PurePath.parts
|
||||
|
||||
A tuple giving access to the path's various components::
|
||||
|
||||
>>> p = PurePath('/usr/bin/python3')
|
||||
>>> p.parts
|
||||
('/', 'usr', 'bin', 'python3')
|
||||
|
||||
>>> p = PureWindowsPath('c:/Program Files/PSF')
|
||||
>>> p.parts
|
||||
('c:\\', 'Program Files', 'PSF')
|
||||
|
||||
(note how the drive and local root are regrouped in a single part)
|
||||
|
||||
|
||||
Methods and properties
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Pure paths provide the following methods and properties:
|
||||
|
||||
.. data:: PurePath.drive
|
||||
|
||||
A string representing the drive letter or name, if any::
|
||||
|
||||
>>> PureWindowsPath('c:/Program Files/').drive
|
||||
'c:'
|
||||
>>> PureWindowsPath('/Program Files/').drive
|
||||
''
|
||||
>>> PurePosixPath('/etc').drive
|
||||
''
|
||||
|
||||
UNC shares are also considered drives::
|
||||
|
||||
>>> PureWindowsPath('//host/share/foo.txt').drive
|
||||
'\\\\host\\share'
|
||||
|
||||
.. data:: PurePath.root
|
||||
|
||||
A string representing the (local or global) root, if any::
|
||||
|
||||
>>> PureWindowsPath('c:/Program Files/').root
|
||||
'\\'
|
||||
>>> PureWindowsPath('c:Program Files/').root
|
||||
''
|
||||
>>> PurePosixPath('/etc').root
|
||||
'/'
|
||||
|
||||
UNC shares always have a root::
|
||||
|
||||
>>> PureWindowsPath('//host/share').root
|
||||
'\\'
|
||||
|
||||
.. data:: PurePath.anchor
|
||||
|
||||
The concatenation of the drive and root::
|
||||
|
||||
>>> PureWindowsPath('c:/Program Files/').anchor
|
||||
'c:\\'
|
||||
>>> PureWindowsPath('c:Program Files/').anchor
|
||||
'c:'
|
||||
>>> PurePosixPath('/etc').anchor
|
||||
'/'
|
||||
>>> PureWindowsPath('//host/share').anchor
|
||||
'\\\\host\\share\\'
|
||||
|
||||
|
||||
.. data:: PurePath.parents
|
||||
|
||||
An immutable sequence providing access to the logical ancestors of
|
||||
the path::
|
||||
|
||||
>>> p = PureWindowsPath('c:/foo/bar/setup.py')
|
||||
>>> p.parents[0]
|
||||
PureWindowsPath('c:/foo/bar')
|
||||
>>> p.parents[1]
|
||||
PureWindowsPath('c:/foo')
|
||||
>>> p.parents[2]
|
||||
PureWindowsPath('c:/')
|
||||
|
||||
|
||||
.. data:: PurePath.parent
|
||||
|
||||
The logical parent of the path::
|
||||
|
||||
>>> p = PurePosixPath('/a/b/c/d')
|
||||
>>> p.parent
|
||||
PurePosixPath('/a/b/c')
|
||||
|
||||
You cannot go past an anchor, or empty path::
|
||||
|
||||
>>> p = PurePosixPath('/')
|
||||
>>> p.parent
|
||||
PurePosixPath('/')
|
||||
>>> p = PurePosixPath('.')
|
||||
>>> p.parent
|
||||
PurePosixPath('.')
|
||||
|
||||
.. note::
|
||||
This is a purely lexical operation, hence the following behaviour::
|
||||
|
||||
>>> p = PurePosixPath('foo/..')
|
||||
>>> p.parent
|
||||
PurePosixPath('foo')
|
||||
|
||||
If you want to walk an arbitrary filesystem path upwards, it is
|
||||
recommended to first call :meth:`Path.resolve` so as to resolve
|
||||
symlinks and eliminate `".."` components.
|
||||
|
||||
|
||||
.. data:: PurePath.name
|
||||
|
||||
A string representing the final path component, excluding the drive and
|
||||
root, if any::
|
||||
|
||||
>>> PurePosixPath('my/library/setup.py').name
|
||||
'setup.py'
|
||||
|
||||
UNC drive names are not considered::
|
||||
|
||||
>>> PureWindowsPath('//some/share/setup.py').name
|
||||
'setup.py'
|
||||
>>> PureWindowsPath('//some/share').name
|
||||
''
|
||||
|
||||
|
||||
.. data:: PurePath.suffix
|
||||
|
||||
The file extension of the final component, if any::
|
||||
|
||||
>>> PurePosixPath('my/library/setup.py').suffix
|
||||
'.py'
|
||||
>>> PurePosixPath('my/library.tar.gz').suffix
|
||||
'.gz'
|
||||
>>> PurePosixPath('my/library').suffix
|
||||
''
|
||||
|
||||
|
||||
.. data:: PurePath.suffixes
|
||||
|
||||
A list of the path's file extensions::
|
||||
|
||||
>>> PurePosixPath('my/library.tar.gar').suffixes
|
||||
['.tar', '.gar']
|
||||
>>> PurePosixPath('my/library.tar.gz').suffixes
|
||||
['.tar', '.gz']
|
||||
>>> PurePosixPath('my/library').suffixes
|
||||
[]
|
||||
|
||||
|
||||
.. data:: PurePath.stem
|
||||
|
||||
The final path component, without its suffix::
|
||||
|
||||
>>> PurePosixPath('my/library.tar.gz').stem
|
||||
'library.tar'
|
||||
>>> PurePosixPath('my/library.tar').stem
|
||||
'library'
|
||||
>>> PurePosixPath('my/library').stem
|
||||
'library'
|
||||
|
||||
|
||||
.. method:: PurePath.as_posix()
|
||||
|
||||
Return a string representation of the path with forward slashes (``/``)::
|
||||
|
||||
>>> p = PureWindowsPath('c:\\windows')
|
||||
>>> str(p)
|
||||
'c:\\windows'
|
||||
>>> p.as_posix()
|
||||
'c:/windows'
|
||||
|
||||
|
||||
.. method:: PurePath.as_uri()
|
||||
|
||||
Represent the path as a ``file`` URI. :exc:`ValueError` is raised if
|
||||
the path isn't absolute.
|
||||
|
||||
>>> p = PurePosixPath('/etc/passwd')
|
||||
>>> p.as_uri()
|
||||
'file:///etc/passwd'
|
||||
>>> p = PureWindowsPath('c:/Windows')
|
||||
>>> p.as_uri()
|
||||
'file:///c:/Windows'
|
||||
|
||||
|
||||
.. method:: PurePath.is_absolute()
|
||||
|
||||
Return whether the path is absolute or not. A path is considered absolute
|
||||
if it has both a root and (if the flavour allows) a drive::
|
||||
|
||||
>>> PurePosixPath('/a/b').is_absolute()
|
||||
True
|
||||
>>> PurePosixPath('a/b').is_absolute()
|
||||
False
|
||||
|
||||
>>> PureWindowsPath('c:/a/b').is_absolute()
|
||||
True
|
||||
>>> PureWindowsPath('/a/b').is_absolute()
|
||||
False
|
||||
>>> PureWindowsPath('c:').is_absolute()
|
||||
False
|
||||
>>> PureWindowsPath('//some/share').is_absolute()
|
||||
True
|
||||
|
||||
|
||||
.. method:: PurePath.is_reserved()
|
||||
|
||||
With :class:`PureWindowsPath`, return ``True`` if the path is considered
|
||||
reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`,
|
||||
``False`` is always returned.
|
||||
|
||||
>>> PureWindowsPath('nul').is_reserved()
|
||||
True
|
||||
>>> PurePosixPath('nul').is_reserved()
|
||||
False
|
||||
|
||||
File system calls on reserved paths can fail mysteriously or have
|
||||
unintended effects.
|
||||
|
||||
|
||||
.. method:: PurePath.joinpath(*other)
|
||||
|
||||
Calling this method is equivalent to combining the path with each of
|
||||
the *other* arguments in turn::
|
||||
|
||||
>>> PurePosixPath('/etc').joinpath('passwd')
|
||||
PurePosixPath('/etc/passwd')
|
||||
>>> PurePosixPath('/etc').joinpath(PurePosixPath('passwd'))
|
||||
PurePosixPath('/etc/passwd')
|
||||
>>> PurePosixPath('/etc').joinpath('init.d', 'apache2')
|
||||
PurePosixPath('/etc/init.d/apache2')
|
||||
>>> PureWindowsPath('c:').joinpath('/Program Files')
|
||||
PureWindowsPath('c:/Program Files')
|
||||
|
||||
|
||||
.. method:: PurePath.match(pattern)
|
||||
|
||||
Match this path against the provided glob-style pattern. Return ``True``
|
||||
if matching is successful, ``False`` otherwise.
|
||||
|
||||
If *pattern* is relative, the path can be either relative or absolute,
|
||||
and matching is done from the right::
|
||||
|
||||
>>> PurePath('a/b.py').match('*.py')
|
||||
True
|
||||
>>> PurePath('/a/b/c.py').match('b/*.py')
|
||||
True
|
||||
>>> PurePath('/a/b/c.py').match('a/*.py')
|
||||
False
|
||||
|
||||
If *pattern* is absolute, the path must be absolute, and the whole path
|
||||
must match::
|
||||
|
||||
>>> PurePath('/a.py').match('/*.py')
|
||||
True
|
||||
>>> PurePath('a/b.py').match('/*.py')
|
||||
False
|
||||
|
||||
As with other methods, case-sensitivity is observed::
|
||||
|
||||
>>> PureWindowsPath('b.py').match('*.PY')
|
||||
True
|
||||
|
||||
|
||||
.. method:: PurePath.relative_to(*other)
|
||||
|
||||
Compute a version of this path relative to the path represented by
|
||||
*other*. If it's impossible, ValueError is raised::
|
||||
|
||||
>>> p = PurePosixPath('/etc/passwd')
|
||||
>>> p.relative_to('/')
|
||||
PurePosixPath('etc/passwd')
|
||||
>>> p.relative_to('/etc')
|
||||
PurePosixPath('passwd')
|
||||
>>> p.relative_to('/usr')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
File "pathlib.py", line 694, in relative_to
|
||||
.format(str(self), str(formatted)))
|
||||
ValueError: '/etc/passwd' does not start with '/usr'
|
||||
|
||||
|
||||
.. method:: PurePath.with_name(name)
|
||||
|
||||
Return a new path with the :attr:`name` changed. If the original path
|
||||
doesn't have a name, ValueError is raised::
|
||||
|
||||
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
|
||||
>>> p.with_name('setup.py')
|
||||
PureWindowsPath('c:/Downloads/setup.py')
|
||||
>>> p = PureWindowsPath('c:/')
|
||||
>>> p.with_name('setup.py')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
File "/home/antoine/cpython/default/Lib/pathlib.py", line 751, in with_name
|
||||
raise ValueError("%r has an empty name" % (self,))
|
||||
ValueError: PureWindowsPath('c:/') has an empty name
|
||||
|
||||
|
||||
.. method:: PurePath.with_suffix(suffix)
|
||||
|
||||
Return a new path with the :attr:`suffix` changed. If the original path
|
||||
doesn't have a suffix, the new *suffix* is appended instead::
|
||||
|
||||
>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')
|
||||
>>> p.with_suffix('.bz2')
|
||||
PureWindowsPath('c:/Downloads/pathlib.tar.bz2')
|
||||
>>> p = PureWindowsPath('README')
|
||||
>>> p.with_suffix('.txt')
|
||||
PureWindowsPath('README.txt')
|
||||
|
||||
|
||||
.. _concrete-paths:
|
||||
|
||||
Concrete paths
|
||||
--------------
|
||||
|
||||
Concrete paths are subclasses of the pure path classes. In addition to
|
||||
operations provided by the latter, they also provide methods to do system
|
||||
calls on path objects. There are three ways to instantiate concrete paths:
|
||||
|
||||
.. class:: Path(*pathsegments)
|
||||
|
||||
A subclass of :class:`PurePath`, this class represents concrete paths of
|
||||
the system's path flavour (instantiating it creates either a
|
||||
:class:`PosixPath` or a :class:`WindowsPath`)::
|
||||
|
||||
>>> Path('setup.py')
|
||||
PosixPath('setup.py')
|
||||
|
||||
*pathsegments* is specified similarly to :class:`PurePath`.
|
||||
|
||||
.. class:: PosixPath(*pathsegments)
|
||||
|
||||
A subclass of :class:`Path` and :class:`PurePosixPath`, this class
|
||||
represents concrete non-Windows filesystem paths::
|
||||
|
||||
>>> PosixPath('/etc')
|
||||
PosixPath('/etc')
|
||||
|
||||
*pathsegments* is specified similarly to :class:`PurePath`.
|
||||
|
||||
.. class:: WindowsPath(*pathsegments)
|
||||
|
||||
A subclass of :class:`Path` and :class:`PureWindowsPath`, this class
|
||||
represents concrete Windows filesystem paths::
|
||||
|
||||
>>> WindowsPath('c:/Program Files/')
|
||||
WindowsPath('c:/Program Files')
|
||||
|
||||
*pathsegments* is specified similarly to :class:`PurePath`.
|
||||
|
||||
You can only instantiate the class flavour that corresponds to your system
|
||||
(allowing system calls on non-compatible path flavours could lead to
|
||||
bugs or failures in your application)::
|
||||
|
||||
>>> import os
|
||||
>>> os.name
|
||||
'posix'
|
||||
>>> Path('setup.py')
|
||||
PosixPath('setup.py')
|
||||
>>> PosixPath('setup.py')
|
||||
PosixPath('setup.py')
|
||||
>>> WindowsPath('setup.py')
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in <module>
|
||||
File "pathlib.py", line 798, in __new__
|
||||
% (cls.__name__,))
|
||||
NotImplementedError: cannot instantiate 'WindowsPath' on your system
|
||||
|
||||
|
||||
Methods
|
||||
^^^^^^^
|
||||
|
||||
Concrete paths provide the following methods in addition to pure paths
|
||||
methods. Many of these methods can raise an :exc:`OSError` if a system
|
||||
call fails (for example because the path doesn't exist):
|
||||
|
||||
.. classmethod:: Path.cwd()
|
||||
|
||||
Return a new path object representing the current directory (as returned
|
||||
by :func:`os.getcwd`)::
|
||||
|
||||
>>> Path.cwd()
|
||||
PosixPath('/home/antoine/pathlib')
|
||||
|
||||
|
||||
.. method:: Path.stat()
|
||||
|
||||
Return information about this path (similarly to :func:`os.stat`).
|
||||
The result is looked up at each call to this method.
|
||||
|
||||
>>> p = Path('setup.py')
|
||||
>>> p.stat().st_size
|
||||
956
|
||||
>>> p.stat().st_mtime
|
||||
1327883547.852554
|
||||
|
||||
|
||||
.. method:: Path.chmod(mode)
|
||||
|
||||
Change the file mode and permissions, like :func:`os.chmod`::
|
||||
|
||||
>>> p = Path('setup.py')
|
||||
>>> p.stat().st_mode
|
||||
33277
|
||||
>>> p.chmod(0o444)
|
||||
>>> p.stat().st_mode
|
||||
33060
|
||||
|
||||
|
||||
.. method:: Path.exists()
|
||||
|
||||
Whether the path points to an existing file or directory::
|
||||
|
||||
>>> from pathlib import *
|
||||
>>> Path('.').exists()
|
||||
True
|
||||
>>> Path('setup.py').exists()
|
||||
True
|
||||
>>> Path('/etc').exists()
|
||||
True
|
||||
>>> Path('nonexistentfile').exists()
|
||||
False
|
||||
|
||||
|
||||
.. method:: Path.glob(pattern)
|
||||
|
||||
Glob the given *pattern* in the directory represented by this path,
|
||||
yielding all matching files (of any kind)::
|
||||
|
||||
>>> sorted(Path('.').glob('*.py'))
|
||||
[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib.py')]
|
||||
>>> sorted(Path('.').glob('*/*.py'))
|
||||
[PosixPath('docs/conf.py')]
|
||||
|
||||
The "``**``" pattern means "this directory and all subdirectories,
|
||||
recursively". In other words, it enables recursive globbing::
|
||||
|
||||
>>> sorted(Path('.').glob('**/*.py'))
|
||||
[PosixPath('build/lib/pathlib.py'),
|
||||
PosixPath('docs/conf.py'),
|
||||
PosixPath('pathlib.py'),
|
||||
PosixPath('setup.py'),
|
||||
PosixPath('test_pathlib.py')]
|
||||
|
||||
.. note::
|
||||
Using the "``**``" pattern in large directory trees may consume
|
||||
an inordinate amount of time.
|
||||
|
||||
|
||||
.. method:: Path.group()
|
||||
|
||||
Return the name of the group owning the file. :exc:`KeyError` is raised
|
||||
if the file's gid isn't found in the system database.
|
||||
|
||||
|
||||
.. method:: Path.is_dir()
|
||||
|
||||
Return ``True`` if the path points to a directory (or a symbolic link
|
||||
pointing to a directory), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_file()
|
||||
|
||||
Return ``True`` if the path points to a regular file (or a symbolic link
|
||||
pointing to a regular file), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_symlink()
|
||||
|
||||
Return ``True`` if the path points to a symbolic link, ``False`` otherwise.
|
||||
|
||||
``False`` is also returned if the path doesn't exist; other errors (such
|
||||
as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_socket()
|
||||
|
||||
Return ``True`` if the path points to a Unix socket (or a symbolic link
|
||||
pointing to a Unix socket), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_fifo()
|
||||
|
||||
Return ``True`` if the path points to a FIFO (or a symbolic link
|
||||
pointing to a FIFO), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_block_device()
|
||||
|
||||
Return ``True`` if the path points to a block device (or a symbolic link
|
||||
pointing to a block device), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.is_char_device()
|
||||
|
||||
Return ``True`` if the path points to a character device (or a symbolic link
|
||||
pointing to a character device), ``False`` if it points to another kind of file.
|
||||
|
||||
``False`` is also returned if the path doesn't exist or is a broken symlink;
|
||||
other errors (such as permission errors) are propagated.
|
||||
|
||||
|
||||
.. method:: Path.iterdir()
|
||||
|
||||
When the path points to a directory, yield path objects of the directory
|
||||
contents::
|
||||
|
||||
>>> p = Path('docs')
|
||||
>>> for child in p.iterdir(): child
|
||||
...
|
||||
PosixPath('docs/conf.py')
|
||||
PosixPath('docs/_templates')
|
||||
PosixPath('docs/make.bat')
|
||||
PosixPath('docs/index.rst')
|
||||
PosixPath('docs/_build')
|
||||
PosixPath('docs/_static')
|
||||
PosixPath('docs/Makefile')
|
||||
|
||||
.. method:: Path.lchmod(mode)
|
||||
|
||||
Like :meth:`Path.chmod` but, if the path points to a symbolic link, the
|
||||
symbolic link's mode is changed rather than its target's.
|
||||
|
||||
|
||||
.. method:: Path.lstat()
|
||||
|
||||
Like :meth:`Path.stat` but, if the path points to a symbolic link, return
|
||||
the symbolic link's information rather than its target's.
|
||||
|
||||
|
||||
.. method:: Path.mkdir(mode=0o777, parents=False)
|
||||
|
||||
Create a new directory at this given path. If *mode* is given, it is
|
||||
combined with the process' ``umask`` value to determine the file mode
|
||||
and access flags. If the path already exists, :exc:`OSError` is raised.
|
||||
|
||||
If *parents* is true, any missing parents of this path are created
|
||||
as needed; they are created with the default permissions without taking
|
||||
*mode* into account (mimicking the POSIX ``mkdir -p`` command).
|
||||
|
||||
If *parents* is false (the default), a missing parent raises
|
||||
:exc:`OSError`.
|
||||
|
||||
|
||||
.. method:: Path.open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)
|
||||
|
||||
Open the file pointed to by the path, like the built-in :func:`open`
|
||||
function does::
|
||||
|
||||
>>> p = Path('setup.py')
|
||||
>>> with p.open() as f:
|
||||
... f.readline()
|
||||
...
|
||||
'#!/usr/bin/env python3\n'
|
||||
|
||||
|
||||
.. method:: Path.owner()
|
||||
|
||||
Return the name of the user owning the file. :exc:`KeyError` is raised
|
||||
if the file's uid isn't found in the system database.
|
||||
|
||||
|
||||
.. method:: Path.rename(target)
|
||||
|
||||
Rename this file or directory to the given *target*. *target* can be
|
||||
either a string or another path object::
|
||||
|
||||
>>> p = Path('foo')
|
||||
>>> p.open('w').write('some text')
|
||||
9
|
||||
>>> target = Path('bar')
|
||||
>>> p.rename(target)
|
||||
>>> target.open().read()
|
||||
'some text'
|
||||
|
||||
|
||||
.. method:: Path.replace(target)
|
||||
|
||||
Rename this file or directory to the given *target*. If *target* points
|
||||
to an existing file or directory, it will be unconditionally replaced.
|
||||
|
||||
This method is only available with Python 3.3; it will raise
|
||||
:exc:`NotImplementedError` on previous Python versions.
|
||||
|
||||
|
||||
.. method:: Path.resolve()
|
||||
|
||||
Make the path absolute, resolving any symlinks. A new path object is
|
||||
returned::
|
||||
|
||||
>>> p = Path()
|
||||
>>> p
|
||||
PosixPath('.')
|
||||
>>> p.resolve()
|
||||
PosixPath('/home/antoine/pathlib')
|
||||
|
||||
`".."` components are also eliminated (this is the only method to do so)::
|
||||
|
||||
>>> p = Path('docs/../setup.py')
|
||||
>>> p.resolve()
|
||||
PosixPath('/home/antoine/pathlib/setup.py')
|
||||
|
||||
If the path doesn't exist, an :exc:`OSError` is raised. If an infinite
|
||||
loop is encountered along the resolution path, :exc:`RuntimeError` is
|
||||
raised.
|
||||
|
||||
|
||||
.. method:: Path.rglob(pattern)
|
||||
|
||||
This is like calling :meth:`glob` with "``**``" added in front of the
|
||||
given *pattern*:
|
||||
|
||||
>>> sorted(Path().rglob("*.py"))
|
||||
[PosixPath('build/lib/pathlib.py'),
|
||||
PosixPath('docs/conf.py'),
|
||||
PosixPath('pathlib.py'),
|
||||
PosixPath('setup.py'),
|
||||
PosixPath('test_pathlib.py')]
|
||||
|
||||
|
||||
.. method:: Path.rmdir()
|
||||
|
||||
Remove this directory. The directory must be empty.
|
||||
|
||||
|
||||
.. method:: Path.symlink_to(target, target_is_directory=False)
|
||||
|
||||
Make this path a symbolic link to *target*. Under Windows,
|
||||
*target_is_directory* must be true (default ``False``) if the link's target
|
||||
is a directory. Under POSIX, *target_is_directory*'s value is ignored.
|
||||
|
||||
>>> p = Path('mylink')
|
||||
>>> p.symlink_to('setup.py')
|
||||
>>> p.resolve()
|
||||
PosixPath('/home/antoine/pathlib/setup.py')
|
||||
>>> p.stat().st_size
|
||||
956
|
||||
>>> p.lstat().st_size
|
||||
8
|
||||
|
||||
.. note::
|
||||
The order of arguments (link, target) is the reverse
|
||||
of :func:`os.symlink`'s.
|
||||
|
||||
|
||||
.. method:: Path.touch(mode=0o777, exist_ok=True)
|
||||
|
||||
Create a file at this given path. If *mode* is given, it is combined
|
||||
with the process' ``umask`` value to determine the file mode and access
|
||||
flags. If the file already exists, the function succeeds if *exist_ok*
|
||||
is true (and its modification time is updated to the current time),
|
||||
otherwise :exc:`OSError` is raised.
|
||||
|
||||
|
||||
.. method:: Path.unlink()
|
||||
|
||||
Remove this file or symbolic link. If the path points to a directory,
|
||||
use :func:`Path.rmdir` instead.
|
190
third_party/python/pathlib/docs/make.bat
vendored
Normal file
190
third_party/python/pathlib/docs/make.bat
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=_build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% .
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pathlib.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pathlib.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
BIN
third_party/python/pathlib/docs/pathlib-inheritance.png
vendored
Normal file
BIN
third_party/python/pathlib/docs/pathlib-inheritance.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
1280
third_party/python/pathlib/pathlib.py
vendored
Normal file
1280
third_party/python/pathlib/pathlib.py
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
third_party/python/pathlib/setup.py
vendored
Executable file
31
third_party/python/pathlib/setup.py
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
from distutils.core import setup
|
||||
|
||||
|
||||
setup(
|
||||
name='pathlib',
|
||||
version=open('VERSION.txt').read().strip(),
|
||||
py_modules=['pathlib'],
|
||||
license='MIT License',
|
||||
description='Object-oriented filesystem paths',
|
||||
long_description=open('README.txt').read(),
|
||||
author='Antoine Pitrou',
|
||||
author_email='solipsis@pitrou.net',
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.2',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Topic :: Software Development :: Libraries',
|
||||
'Topic :: System :: Filesystems',
|
||||
],
|
||||
download_url='https://pypi.python.org/pypi/pathlib/',
|
||||
url='https://pathlib.readthedocs.org/',
|
||||
)
|
1897
third_party/python/pathlib/test_pathlib.py
vendored
Executable file
1897
third_party/python/pathlib/test_pathlib.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user