[med-svn] [python-shellescape] 01/02: Import Upstream version 3.4.1

Andreas Tille tille at debian.org
Fri Feb 24 12:38:43 UTC 2017


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

tille pushed a commit to branch master
in repository python-shellescape.

commit 541dc5cc3b97fc6227e743e24fed5af314562862
Author: Andreas Tille <tille at debian.org>
Date:   Fri Feb 24 10:16:35 2017 +0100

    Import Upstream version 3.4.1
---
 MANIFEST.in                                   |   1 +
 PKG-INFO                                      | 103 ++++++++++++++++++++++++++
 docs/LICENSE                                  |  56 ++++++++++++++
 docs/README.rst                               |  81 ++++++++++++++++++++
 lib/shellescape.egg-info/PKG-INFO             | 103 ++++++++++++++++++++++++++
 lib/shellescape.egg-info/SOURCES.txt          |  12 +++
 lib/shellescape.egg-info/dependency_links.txt |   1 +
 lib/shellescape.egg-info/top_level.txt        |   1 +
 lib/shellescape/__init__.py                   |   4 +
 lib/shellescape/main.py                       |  21 ++++++
 lib/shellescape/settings.py                   |  15 ++++
 setup.cfg                                     |   8 ++
 setup.py                                      |  57 ++++++++++++++
 13 files changed, 463 insertions(+)

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..0043201
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+recursive-include docs *
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..a7cb208
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,103 @@
+Metadata-Version: 1.1
+Name: shellescape
+Version: 3.4.1
+Summary: Shell escape a string to safely use it as a token in a shell command (backport of Python shlex.quote for Python versions 2.x & < 3.3)
+Home-page: https://github.com/chrissimpkins/shellescape
+Author: Christopher Simpkins
+Author-email: git.simpkins at gmail.com
+License: MIT license
+Description: Source Repository: https://github.com/chrissimpkins/shellescape
+        
+        Description
+        -----------
+        
+        The shellescape Python module defines the ``shellescape.quote()`` function that returns a shell-escaped version of a Python string.  This is a backport of the ``shlex.quote()`` function from Python 3.4.3 that makes it accessible to users of Python 3 versions < 3.3 and all Python 2.x versions.
+        
+        quote(s)
+        --------
+        
+        From the Python documentation:
+        
+        Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list.
+        
+        This idiom would be unsafe:
+        
+        .. code-block:: python
+        
+        	>>> filename = 'somefile; rm -rf ~'
+        	>>> command = 'ls -l {}'.format(filename)
+        	>>> print(command)  # executed by a shell: boom!
+        	ls -l somefile; rm -rf ~
+        
+        
+        ``quote()`` lets you plug the security hole:
+        
+        .. code-block:: python
+        
+        	>>> command = 'ls -l {}'.format(quote(filename))
+        	>>> print(command)
+        	ls -l 'somefile; rm -rf ~'
+        	>>> remote_command = 'ssh home {}'.format(quote(command))
+        	>>> print(remote_command)
+        	ssh home 'ls -l '"'"'somefile; rm -rf ~'"'"''
+        
+        
+        The quoting is compatible with UNIX shells and with ``shlex.split()``:
+        
+        .. code-block:: python
+        
+        	>>> remote_command = split(remote_command)
+        	>>> remote_command
+        	['ssh', 'home', "ls -l 'somefile; rm -rf ~'"]
+        	>>> command = split(remote_command[-1])
+        	>>> command
+        	['ls', '-l', 'somefile; rm -rf ~']
+        
+        
+        Usage
+        -----
+        
+        Include ``shellescape`` in your project setup.py file ``install_requires`` dependency definition list:
+        
+        .. code-block:: python
+        
+        	setup(
+        	    ...
+        	    install_requires=['shellescape'],
+        	    ...
+        	)
+        
+        
+        Then import the ``quote`` function into your module(s) and use it as needed:
+        
+        .. code-block:: python
+        
+        	#!/usr/bin/env python
+        	# -*- coding: utf-8 -*-
+        
+        	from shellescape import quote
+        
+        	filename = "somefile; rm -rf ~"
+        	escaped_shell_command = 'ls -l {}'.format(quote(filename))
+        
+        
+        Issue Reporting
+        ---------------
+        
+        Issue reporting is available on the `GitHub repository <https://github.com/chrissimpkins/shellescape/issues>`_
+        
+        
+        
+Keywords: shell,quote,escape,backport,command line,command,subprocess
+Platform: any
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Unix
+Classifier: Operating System :: Microsoft :: Windows
diff --git a/docs/LICENSE b/docs/LICENSE
new file mode 100644
index 0000000..5f80fb0
--- /dev/null
+++ b/docs/LICENSE
@@ -0,0 +1,56 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Christopher Simpkins
+
+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.
+
+
+
+
+SUMMARY OF CHANGES
+
+The Python 3.4.3 function `quote` from the `shlex` module (`shlex.quote()`) was backported in order to provide access
+to this function in earlier versions of Python.  The regular expression used to identify unsafe command line strings
+was modified to:
+
+_find_unsafe = re.compile(r'[a-zA-Z0-9_^@%+=:,./-]').search
+
+from:
+
+_find_unsafe = re.compile(r'[^\w@%+=:,./-]', re.ASCII).search
+
+in order to remove the re.ASCII flag which is not available in the Python 2.x re module
+
+
+
+PSF LICENSE AGREEMENT FOR PYTHON 3.4.3
+
+This LICENSE AGREEMENT is between the Python Software Foundation (“PSF”), and the Individual or Organization (“Licensee”) accessing and otherwise using Python 3.4.3 software in source or binary form and its associated documentation.
+
+Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 3.4.3 alone or in any derivative version, provided, however, that PSF’s License Agreement and PSF’s notice of copyright, i.e., “Copyright © 2001-2015 Python Software Foundation; All Rights Reserved” are retained in Python 3.4.3  [...]
+
+In the event Licensee prepares a derivative work that is based on or incorporates Python 3.4.3 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 3.4.3.
+
+PSF is making Python 3.4.3 available to Licensee on an “AS IS” basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 3.4.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.4.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.4.3, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+This License Agreement will automatically terminate upon a material breach of its terms and conditions.
+Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
+
+By copying, installing or otherwise using Python 3.4.3, Licensee agrees to be bound by the terms and conditions of this License Agreement.
diff --git a/docs/README.rst b/docs/README.rst
new file mode 100644
index 0000000..5330472
--- /dev/null
+++ b/docs/README.rst
@@ -0,0 +1,81 @@
+Source Repository: https://github.com/chrissimpkins/shellescape
+
+Description
+-----------
+
+The shellescape Python module defines the ``shellescape.quote()`` function that returns a shell-escaped version of a Python string.  This is a backport of the ``shlex.quote()`` function from Python 3.4.3 that makes it accessible to users of Python 3 versions < 3.3 and all Python 2.x versions.
+
+quote(s)
+--------
+
+From the Python documentation:
+
+Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list.
+
+This idiom would be unsafe:
+
+.. code-block:: python
+
+	>>> filename = 'somefile; rm -rf ~'
+	>>> command = 'ls -l {}'.format(filename)
+	>>> print(command)  # executed by a shell: boom!
+	ls -l somefile; rm -rf ~
+
+
+``quote()`` lets you plug the security hole:
+
+.. code-block:: python
+
+	>>> command = 'ls -l {}'.format(quote(filename))
+	>>> print(command)
+	ls -l 'somefile; rm -rf ~'
+	>>> remote_command = 'ssh home {}'.format(quote(command))
+	>>> print(remote_command)
+	ssh home 'ls -l '"'"'somefile; rm -rf ~'"'"''
+
+
+The quoting is compatible with UNIX shells and with ``shlex.split()``:
+
+.. code-block:: python
+
+	>>> remote_command = split(remote_command)
+	>>> remote_command
+	['ssh', 'home', "ls -l 'somefile; rm -rf ~'"]
+	>>> command = split(remote_command[-1])
+	>>> command
+	['ls', '-l', 'somefile; rm -rf ~']
+
+
+Usage
+-----
+
+Include ``shellescape`` in your project setup.py file ``install_requires`` dependency definition list:
+
+.. code-block:: python
+
+	setup(
+	    ...
+	    install_requires=['shellescape'],
+	    ...
+	)
+
+
+Then import the ``quote`` function into your module(s) and use it as needed:
+
+.. code-block:: python
+
+	#!/usr/bin/env python
+	# -*- coding: utf-8 -*-
+
+	from shellescape import quote
+
+	filename = "somefile; rm -rf ~"
+	escaped_shell_command = 'ls -l {}'.format(quote(filename))
+
+
+Issue Reporting
+---------------
+
+Issue reporting is available on the `GitHub repository <https://github.com/chrissimpkins/shellescape/issues>`_
+
+
diff --git a/lib/shellescape.egg-info/PKG-INFO b/lib/shellescape.egg-info/PKG-INFO
new file mode 100644
index 0000000..a7cb208
--- /dev/null
+++ b/lib/shellescape.egg-info/PKG-INFO
@@ -0,0 +1,103 @@
+Metadata-Version: 1.1
+Name: shellescape
+Version: 3.4.1
+Summary: Shell escape a string to safely use it as a token in a shell command (backport of Python shlex.quote for Python versions 2.x & < 3.3)
+Home-page: https://github.com/chrissimpkins/shellescape
+Author: Christopher Simpkins
+Author-email: git.simpkins at gmail.com
+License: MIT license
+Description: Source Repository: https://github.com/chrissimpkins/shellescape
+        
+        Description
+        -----------
+        
+        The shellescape Python module defines the ``shellescape.quote()`` function that returns a shell-escaped version of a Python string.  This is a backport of the ``shlex.quote()`` function from Python 3.4.3 that makes it accessible to users of Python 3 versions < 3.3 and all Python 2.x versions.
+        
+        quote(s)
+        --------
+        
+        From the Python documentation:
+        
+        Return a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line, for cases where you cannot use a list.
+        
+        This idiom would be unsafe:
+        
+        .. code-block:: python
+        
+        	>>> filename = 'somefile; rm -rf ~'
+        	>>> command = 'ls -l {}'.format(filename)
+        	>>> print(command)  # executed by a shell: boom!
+        	ls -l somefile; rm -rf ~
+        
+        
+        ``quote()`` lets you plug the security hole:
+        
+        .. code-block:: python
+        
+        	>>> command = 'ls -l {}'.format(quote(filename))
+        	>>> print(command)
+        	ls -l 'somefile; rm -rf ~'
+        	>>> remote_command = 'ssh home {}'.format(quote(command))
+        	>>> print(remote_command)
+        	ssh home 'ls -l '"'"'somefile; rm -rf ~'"'"''
+        
+        
+        The quoting is compatible with UNIX shells and with ``shlex.split()``:
+        
+        .. code-block:: python
+        
+        	>>> remote_command = split(remote_command)
+        	>>> remote_command
+        	['ssh', 'home', "ls -l 'somefile; rm -rf ~'"]
+        	>>> command = split(remote_command[-1])
+        	>>> command
+        	['ls', '-l', 'somefile; rm -rf ~']
+        
+        
+        Usage
+        -----
+        
+        Include ``shellescape`` in your project setup.py file ``install_requires`` dependency definition list:
+        
+        .. code-block:: python
+        
+        	setup(
+        	    ...
+        	    install_requires=['shellescape'],
+        	    ...
+        	)
+        
+        
+        Then import the ``quote`` function into your module(s) and use it as needed:
+        
+        .. code-block:: python
+        
+        	#!/usr/bin/env python
+        	# -*- coding: utf-8 -*-
+        
+        	from shellescape import quote
+        
+        	filename = "somefile; rm -rf ~"
+        	escaped_shell_command = 'ls -l {}'.format(quote(filename))
+        
+        
+        Issue Reporting
+        ---------------
+        
+        Issue reporting is available on the `GitHub repository <https://github.com/chrissimpkins/shellescape/issues>`_
+        
+        
+        
+Keywords: shell,quote,escape,backport,command line,command,subprocess
+Platform: any
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 3
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Unix
+Classifier: Operating System :: Microsoft :: Windows
diff --git a/lib/shellescape.egg-info/SOURCES.txt b/lib/shellescape.egg-info/SOURCES.txt
new file mode 100644
index 0000000..572959c
--- /dev/null
+++ b/lib/shellescape.egg-info/SOURCES.txt
@@ -0,0 +1,12 @@
+MANIFEST.in
+setup.cfg
+setup.py
+docs/LICENSE
+docs/README.rst
+lib/shellescape/__init__.py
+lib/shellescape/main.py
+lib/shellescape/settings.py
+lib/shellescape.egg-info/PKG-INFO
+lib/shellescape.egg-info/SOURCES.txt
+lib/shellescape.egg-info/dependency_links.txt
+lib/shellescape.egg-info/top_level.txt
\ No newline at end of file
diff --git a/lib/shellescape.egg-info/dependency_links.txt b/lib/shellescape.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/lib/shellescape.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/lib/shellescape.egg-info/top_level.txt b/lib/shellescape.egg-info/top_level.txt
new file mode 100644
index 0000000..0d98e3a
--- /dev/null
+++ b/lib/shellescape.egg-info/top_level.txt
@@ -0,0 +1 @@
+shellescape
diff --git a/lib/shellescape/__init__.py b/lib/shellescape/__init__.py
new file mode 100644
index 0000000..00ba358
--- /dev/null
+++ b/lib/shellescape/__init__.py
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from .main import quote
diff --git a/lib/shellescape/main.py b/lib/shellescape/main.py
new file mode 100644
index 0000000..0d06b7a
--- /dev/null
+++ b/lib/shellescape/main.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import re
+
+
+_find_unsafe = re.compile(r'[a-zA-Z0-9_^@%+=:,./-]').search
+
+
+def quote(s):
+    """Return a shell-escaped version of the string *s*."""
+    if not s:
+        return "''"
+
+    if _find_unsafe(s) is None:
+        return s
+
+    # use single quotes, and put single quotes into double quotes
+    # the string $'b is then quoted as '$'"'"'b'
+
+    return "'" + s.replace("'", "'\"'\"'") + "'"
diff --git a/lib/shellescape/settings.py b/lib/shellescape/settings.py
new file mode 100644
index 0000000..c39e436
--- /dev/null
+++ b/lib/shellescape/settings.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# ------------------------------------------------------------------------------
+# Application Name
+# ------------------------------------------------------------------------------
+app_name = 'shellescape'
+
+# ------------------------------------------------------------------------------
+# Version Number
+# ------------------------------------------------------------------------------
+major_version = "3"
+minor_version = "4"
+patch_version = "1"
+
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..6c71b61
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,8 @@
+[wheel]
+universal = 1
+
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..52824c3
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,57 @@
+import os
+import re
+from setuptools import setup, find_packages
+
+
+def docs_read(fname):
+    return open(os.path.join(os.path.dirname(__file__), 'docs', fname)).read()
+
+
+def version_read():
+    settings_file = open(os.path.join(os.path.dirname(__file__), 'lib', 'shellescape', 'settings.py')).read()
+    major_regex = """major_version\s*?=\s*?["']{1}(\d+)["']{1}"""
+    minor_regex = """minor_version\s*?=\s*?["']{1}(\d+)["']{1}"""
+    patch_regex = """patch_version\s*?=\s*?["']{1}(\d+)["']{1}"""
+    major_match = re.search(major_regex, settings_file)
+    minor_match = re.search(minor_regex, settings_file)
+    patch_match = re.search(patch_regex, settings_file)
+    major_version = major_match.group(1)
+    minor_version = minor_match.group(1)
+    patch_version = patch_match.group(1)
+    if len(major_version) == 0:
+        major_version = 0
+    if len(minor_version) == 0:
+        minor_version = 0
+    if len(patch_version) == 0:
+        patch_version = 0
+    return major_version + "." + minor_version + "." + patch_version
+
+
+setup(
+    name='shellescape',
+    version=version_read(),
+    description='Shell escape a string to safely use it as a token in a shell command (backport of Python shlex.quote for Python versions 2.x & < 3.3)',
+    long_description=(docs_read('README.rst')),
+    url='https://github.com/chrissimpkins/shellescape',
+    license='MIT license',
+    author='Christopher Simpkins',
+    author_email='git.simpkins at gmail.com',
+    platforms=['any'],
+    packages=find_packages("lib"),
+    package_dir={'': 'lib'},
+    keywords='shell,quote,escape,backport,command line,command,subprocess',
+    include_package_data=True,
+    classifiers=[
+        'Development Status :: 5 - Production/Stable',
+        'Intended Audience :: Developers',
+        'Natural Language :: English',
+        'License :: OSI Approved :: MIT License',
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 3',
+        'Operating System :: MacOS :: MacOS X',
+        'Operating System :: POSIX',
+        'Operating System :: Unix',
+        'Operating System :: Microsoft :: Windows'
+    ],
+)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-shellescape.git



More information about the debian-med-commit mailing list