[Python-modules-commits] [python-rpaths] 01/03: New upstream version 0.13

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Apr 18 10:59:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch master
in repository python-rpaths.

commit d5b4d2346d6ca03a28cb31632f1a1f5e4e3d20a2
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date:   Tue Apr 18 10:47:01 2017 +0100

    New upstream version 0.13
---
 CHANGELOG.md                         |  112 ++++
 LICENSE                              |   26 +
 MANIFEST.in                          |    6 +
 PKG-INFO                             |   25 +
 README.md                            |   34 +
 doc/Makefile                         |  177 +++++
 doc/conf.py                          |  265 ++++++++
 doc/index.rst                        |   62 ++
 rpaths.egg-info/PKG-INFO             |   25 +
 rpaths.egg-info/SOURCES.txt          |   18 +
 rpaths.egg-info/dependency_links.txt |    1 +
 rpaths.egg-info/top_level.txt        |    1 +
 rpaths.py                            | 1210 ++++++++++++++++++++++++++++++++++
 setup.cfg                            |    7 +
 setup.py                             |   30 +
 tests/__init__.py                    |    0
 tests/__main__.py                    |   40 ++
 tests/test_abstract.py               |  355 ++++++++++
 tests/test_concrete.py               |  341 ++++++++++
 19 files changed, 2735 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..5fb05e0
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,112 @@
+Changelog
+=========
+
+0.13 (2017-04-17)
+-----------------
+
+Enhancements:
+* Add documentation to sdist (by @ghisvail, #20)
+* Run tests with UTF-8 path encoding (this means they'll pass even on a machine with ASCII locale)
+
+0.12 (2016-03-25)
+-----------------
+
+Enhancements:
+* Don't follow symlinks in `recursedir()`
+* Allow `recursedir()` to keep going by passing it a `handle_errors` callback instead of letting it raise.
+
+Behavior change:
+* `recursedir()` now doesn't follow symlinks unless you set `follow_links=True` explicitely
+
+0.11 (2015-08-26)
+-----------------
+
+Enhancements:
+* Add a `Pattern` class, exposing pattern-matching outside of directory listing.
+
+0.10 (2014-11-06)
+-----------------
+
+Bugfixes:
+* Fixes a `rel_path_to()` bug on Python 3
+* Fixes `'.'.rel_path_to('.')` exception
+* Fixes `tempfile()` and `tempdir()` not accepting Path as 'dir' parameter
+
+0.9 (2014-10-20)
+----------------
+
+Features:
+* unicode() conversion uses `surrogateescape` on Python 3
+
+0.8 (2014-08-15)
+----------------
+
+Bugfixes:
+* Fixes recursedir()'s recursing on too many folders
+
+Features:
+* chown() now has 'no change' defaults for uid and gid
+* Adds '+' operator to add a string to the end of the name of a path
+* Adds `Path#rewrite()` context-manager, for rewriting a file in-place
+
+0.7 (2014-07-24)
+----------------
+
+Features:
+* Extended glob filters (� la git, /some/dir*/**/*.log)
+* Python 3.2 compatibility
+
+0.6 (2014-07-21)
+----------------
+
+Bugfixes:
+* Fixes non-working `Path#rel_path_to()`.
+
+0.5 (2014-06-26)
+----------------
+
+Features:
+* Adds `pattern` parameter to `listdir()` and `recursedir()`
+
+0.4 (2014-06-19)
+----------------
+
+Bugfixes:
+* Adds missing `__all__` lists
+* Actually prevents the creation of `AbstractPath` directly (thanks to VnC-)
+
+Features:
+* Adds comparison operators
+
+0.3 (2014-06-11)
+----------------
+
+Bugfixes:
+* `Path.read_link()` didn't work at all.
+* `AbstractPath.__eq__()` now returns False instead of raising TypeError if the
+  objects are not compatible.
+
+Features:
+* Adds `AbstractPath.lies_under()`
+* `Path.open()` uses `io.open()`. It now accepts the buffering, encoding,
+  errors, newline, closefd and opener arguments, and will return unicode
+  instead of bytes if opened in text mode (the default) on Python 2.
+
+0.2 (2014-06-09)
+----------------
+
+Bugfixes:
+* Makes `__hash__` use `normcase` (like `__eq__` does).
+* Removes `AbstractPath.relative()` since it only worked for `Path` anyway.
+* Fixes `*atime` methods.
+
+Features:
+* Adds docstrings everywhere. There is some HTML documentation at ReadTheDocs:
+  http://rpaths.remram.fr/
+
+0.1 (2014-06-07)
+----------------
+
+* Basic functionality.
+* Stores paths as `unicode` or `bytes` depending on path type.
+* `AbstractPath`/`Path` separation.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..56cd279
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2014, Remi Rampin
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..a2b1820
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,6 @@
+include README.md
+include LICENSE
+include CHANGELOG.md
+graft tests
+graft doc
+global-exclude *.py[co]
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..42e1ebd
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,25 @@
+Metadata-Version: 1.1
+Name: rpaths
+Version: 0.13
+Summary: Path manipulation library
+Home-page: http://github.com/remram44/rpaths
+Author: Remi Rampin
+Author-email: remirampin at gmail.com
+License: BSD
+Description: rpaths is another path manipulation library. It is heavily inspired by Unipath
+        and pathlib.
+        
+        It aims at total Python 2/3 and Windows/POSIX compatibility. To my knowledge,
+        no other library can handle all the possible paths on every platform.
+        
+Keywords: path,file,filename,pattern,fnmatch
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: System :: Filesystems
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..86d6626
--- /dev/null
+++ b/README.md
@@ -0,0 +1,34 @@
+[![Linux Build](https://travis-ci.org/remram44/rpaths.svg?branch=master)](https://travis-ci.org/remram44/rpaths)
+[![Win Build](https://ci.appveyor.com/api/projects/status/s7efr8aoqkyp69t0/branch/master)](https://ci.appveyor.com/project/remram44/rpaths)
+[![Coverage Status](http://codecov.io/github/remram44/rpaths/coverage.svg?branch=master)](http://codecov.io/github/remram44/rpaths/coverage.svg?branch=master)
+
+rpaths
+======
+
+rpaths is yet another path manipulation library.
+
+The [full documentation is built by ReadTheDocs]
+(http://rpaths.remram.fr/en/latest/).
+
+It pains me that I should have to write this, however after a survey of the
+existing packages, including [pathlib]
+(https://docs.python.org/3/library/pathlib.html) (included in the Python
+standard library since 3.4, see [PEP 428]
+(http://legacy.python.org/dev/peps/pep-0428/)), it appears that every one of
+them chokes on one valid filename or another.
+
+* [Unipath](https://github.com/mikeorr/Unipath) is very close. In fact it is,
+with pathlib, one of the main inspirations for this work. Unfortunately it
+makes its path inherit from unicode or bytes, which makes the abstract/concrete
+class separation too tricky.
+* [pathlib](https://bitbucket.org/pitrou/pathlib/) is affected with
+[a bug preventing it from representing some filenames on Windows on Python 2]
+(https://bitbucket.org/pitrou/pathlib/issue/25); this bug was marked as
+wontfix. Furthermore, it works very differently on Python 2 and 3, which I
+believe is very counter-productive.
+* [path.py](https://github.com/jaraco/path.py) is affected with [a bug making
+it fail when encountering some filenames on POSIX]
+(https://github.com/jaraco/path.py/issues/61). This is also believed to allow
+for DoS attacks.
+* [fpath](https://github.com/wackywendell/fpath) is affected with the
+[same bug](https://github.com/wackywendell/fpath/issues/5) as path.py.
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..511333d
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# 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 "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@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 "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@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/rpaths.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/rpaths.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/rpaths"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/rpaths"
+	@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."
+
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@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."
+
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/conf.py b/doc/conf.py
new file mode 100644
index 0000000..8bed92c
--- /dev/null
+++ b/doc/conf.py
@@ -0,0 +1,265 @@
+# -*- coding: utf-8 -*-
+#
+# rpaths documentation build configuration file, created by
+# sphinx-quickstart on Sat Jun 07 16:49:11 2014.
+#
+# 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
+import 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 = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.intersphinx',
+]
+
+# 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 = u'rpaths'
+copyright = u'2014, Remi Rampin'
+
+# 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 = '0.13'
+# The full version, including alpha/beta/rc tags.
+release = '0.13'
+
+# 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 = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+
+# -- 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']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# 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 = 'rpathsdoc'
+
+
+# -- 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, or own class]).
+latex_documents = [
+  ('index', 'rpaths.tex', u'rpaths Documentation',
+   u'Remi Rampin', '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', 'rpaths', u'rpaths Documentation',
+     [u'Remi Rampin'], 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', 'rpaths', u'rpaths Documentation',
+   u'Remi Rampin', 'rpaths', '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'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/2/': None}
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644
index 0000000..d94164c
--- /dev/null
+++ b/doc/index.rst
@@ -0,0 +1,62 @@
+.. _index:
+
+rpaths: a compatible, object-oriented path manipulation library
+===============================================================
+
+Introduction
+------------
+
+Python provides a module to manipulate filenames: :mod:`os.path`. However, it
+is very cumbersome to use (not object-oriented) and difficult to use safely
+(because of the bytes/unicode issue).
+
+This library provides classes allowing you to perform all the common operations
+on paths easily, using ad-hoc classes.
+
+Moreover, it aims at total Python 2/3 and Windows/POSIX interoperability. In
+every case, it will behave the "right way", even when dealing with POSIX
+filenames in broken unicode encodings.
+
+Development happens on Github: https://github.com/remram44/rpaths. Feel free to
+report bugs, request features or direct your patches there.
+
+Classes
+-------
+
+rpaths is organized in two levels. It offers abstract path representations,
+which only perform parsing/string manipulation and don't actually perform any
+operation on a file system. When dealing with abstract paths, nothing stops you
+from manipulating POSIX paths on a Windows host and vice-versa.
+
+On top of these abstract paths comes the concrete :class:`~rpaths.Path` class,
+which represents the native type for the current system. It inherits from the
+correct abstract class, and adds the actual system operations allowing you to
+resolve, list, create or remove files.
+
+Note that, contrary to other path libraries, none of these types inherits from
+a built-in string class. However, you can build them from strings in a variety
+of ways and :func:`repr`, :func:`bytes` and :func:`unicode` will behave how you
+can expect.
+
+Abstract classes
+''''''''''''''''
+
+Abstract path behavior is defined by the :class:`~rpaths.AbstractPath` class.
+You shouldn't use that directly, use :class:`~rpaths.PosixPath` and
+:class:`~rpaths.WindowsPath` which are its implementations.
+
+.. autoclass:: rpaths.AbstractPath
+   :members:
+
+.. autoclass:: rpaths.PosixPath
+
+.. autoclass:: rpaths.WindowsPath
+
+Concrete class Path
+'''''''''''''''''''
+
+The class Path represents a native path on your system. It inherits from either
+:class:`~rpaths.PosixPath` or :class:`~rpaths.WindowsPath`.
+
+.. autoclass:: rpaths.Path
+   :members:
diff --git a/rpaths.egg-info/PKG-INFO b/rpaths.egg-info/PKG-INFO
new file mode 100644
index 0000000..42e1ebd
--- /dev/null
+++ b/rpaths.egg-info/PKG-INFO
@@ -0,0 +1,25 @@
+Metadata-Version: 1.1
+Name: rpaths
+Version: 0.13
+Summary: Path manipulation library
+Home-page: http://github.com/remram44/rpaths
+Author: Remi Rampin
+Author-email: remirampin at gmail.com
+License: BSD
+Description: rpaths is another path manipulation library. It is heavily inspired by Unipath
+        and pathlib.
+        
+        It aims at total Python 2/3 and Windows/POSIX compatibility. To my knowledge,
+        no other library can handle all the possible paths on every platform.
+        
+Keywords: path,file,filename,pattern,fnmatch
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Topic :: System :: Filesystems
diff --git a/rpaths.egg-info/SOURCES.txt b/rpaths.egg-info/SOURCES.txt
new file mode 100644
index 0000000..6c0a772
--- /dev/null
+++ b/rpaths.egg-info/SOURCES.txt
@@ -0,0 +1,18 @@
+CHANGELOG.md
+LICENSE
+MANIFEST.in
+README.md
+rpaths.py
+setup.cfg
+setup.py
+doc/Makefile
+doc/conf.py
+doc/index.rst
+rpaths.egg-info/PKG-INFO
+rpaths.egg-info/SOURCES.txt
+rpaths.egg-info/dependency_links.txt
+rpaths.egg-info/top_level.txt
+tests/__init__.py
+tests/__main__.py
+tests/test_abstract.py
+tests/test_concrete.py
\ No newline at end of file
diff --git a/rpaths.egg-info/dependency_links.txt b/rpaths.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/rpaths.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/rpaths.egg-info/top_level.txt b/rpaths.egg-info/top_level.txt
new file mode 100644
index 0000000..9f84dad
--- /dev/null
+++ b/rpaths.egg-info/top_level.txt
@@ -0,0 +1 @@
+rpaths
diff --git a/rpaths.py b/rpaths.py
new file mode 100644
index 0000000..783592f
--- /dev/null
+++ b/rpaths.py
@@ -0,0 +1,1210 @@
+from __future__ import unicode_literals
+
+import contextlib
+import functools
+import io
+import ntpath
+import os
+import posixpath
+import re
+import shutil
+import sys
+import tempfile
+
+
+__all__ = ["unicode", "Path", "PY3", "PosixPath", "WindowsPath"]
+
+__version__ = '0.13'
+
+
+PY3 = sys.version_info[0] == 3
+
+if PY3:
+    unicode = str
+else:
+    unicode = unicode
+backend_types = (unicode, bytes)
+
+
+MAX_CACHE = 128
+if hasattr(functools, 'lru_cache'):
+    memoize1 = functools.lru_cache(MAX_CACHE)
+else:
+    def memoize1(f):
+        _cache = {}
+
+        @functools.wraps(f)
+        def wrapped(arg):
+            if arg in _cache:
+                return _cache[arg]
+            else:
+                res = f(arg)
+                if len(_cache) > MAX_CACHE:
+                    _cache.clear()
+                _cache[arg] = res
+                return res
+
+        return wrapped
+
+
+def supports_unicode_filenames(lib):
+    # Python is bugged; lib.supports_unicode_filenames is wrong
+    return lib is ntpath
+
+
+def dict_union(*dcts):
+    dct = {}
+    for dct2 in dcts:
+        dct.update(dct2)
+    return dct
+
+
+class AbstractPath(object):
+    """An abstract representation of a path.
+
+    This represents a path on a system that may not be the current one. It
+    doesn't provide any way to actually interact with the local file system.
+    """
+    _lib = None
+
+    def _to_backend(self, p):
+        """Converts something to the correct path representation.
+
+        If given a Path, this will simply unpack it, if it's the correct type.
+        If given the correct backend, it will return that.
+        If given bytes for unicode of unicode for bytes, it will encode/decode
+        with a reasonable encoding. Note that these operations can raise
+        UnicodeError!
+        """
+        if isinstance(p, self._cmp_base):
+            return p.path
+        elif isinstance(p, self._backend):
+            return p
+        elif self._backend is unicode and isinstance(p, bytes):
+            return p.decode(self._encoding)
+        elif self._backend is bytes and isinstance(p, unicode):
+            return p.encode(self._encoding,
+                            'surrogateescape' if PY3 else 'strict')
+        else:
+            raise TypeError("Can't construct a %s from %r" % (
+                            self.__class__.__name__, type(p)))
+
+    def __init__(self, *parts):
+        """Creates a path from one or more components.
+        """
+        if self._lib is None:  # pragma: no cover
+            raise RuntimeError("Can't create an AbstractPath directly!")
+        self._backend = (unicode if supports_unicode_filenames(self._lib)
+                         else bytes)
+        self._sep = self._lib.sep
+        if self._backend is unicode and isinstance(self._sep, bytes):
+            self._sep = self._sep.decode('ascii')
+        elif self._backend is bytes and isinstance(self._sep, unicode):
+            self._sep = self._sep.encode('ascii')
+        self.path = self._normpath(
+            self._lib.join(*[self._to_backend(p) for p in parts]))
+
+    @classmethod
+    def _normpath(cls, p):
+        """This gets a pathname into the proper form it will be stored as.
+        """
+        return cls._lib.normpath(p)
+
+    @classmethod
+    def _normcase(cls, p):
+        """This gets a pathname into the proper form for equality testing.
+        """
+        return cls._lib.normcase(p)
+
+    def __div__(self, other):
+        """Joins two paths.
+        """
+        return self.__class__(self, other)
+    __truediv__ = __div__
+
+    def __add__(self, other):
+        """Adds a suffix to some path (for example, '.bak').
+        """
+        if not isinstance(other, backend_types):
+            raise TypeError("+ operator expects a str or bytes object, "
+                            "got %r" % type(other))
+        other = self._to_backend(other)
+        if self._to_backend('/') in other or self._sep in other:
+            raise ValueError("Can't add separators to filename with +, use /")
+        return self.__class__(self.path + other)
+
+    def __eq__(self, other):
+        """Compares two paths.
+
+        This will ignore the case on systems where it is not relevant. Note
+        that if two paths are equal, they represent the same file, but the
+        opposite might not be true.
+        """
... 1874 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-rpaths.git



More information about the Python-modules-commits mailing list