second commit
This commit is contained in:
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/INSTALLER
vendored
Normal file
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/INSTALLER
vendored
Normal file
@ -0,0 +1 @@
|
||||
pip
|
13
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/LICENSE
vendored
Normal file
13
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/LICENSE
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright (c) 2018, Tzu-ping Chung <uranusjr@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
106
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/METADATA
vendored
Normal file
106
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/METADATA
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: shellingham
|
||||
Version: 1.5.4
|
||||
Summary: Tool to Detect Surrounding Shell
|
||||
Home-page: https://github.com/sarugaku/shellingham
|
||||
Author: Tzu-ping Chung
|
||||
Author-email: uranusjr@gmail.com
|
||||
License: ISC License
|
||||
Keywords: shell
|
||||
Classifier: Development Status :: 3 - Alpha
|
||||
Classifier: Environment :: Console
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: ISC License (ISCL)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Python: >=3.7
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE
|
||||
|
||||
=============================================
|
||||
Shellingham: Tool to Detect Surrounding Shell
|
||||
=============================================
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/shellingham.svg
|
||||
:target: https://pypi.org/project/shellingham/
|
||||
|
||||
Shellingham detects what shell the current Python executable is running in.
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> import shellingham
|
||||
>>> shellingham.detect_shell()
|
||||
('bash', '/bin/bash')
|
||||
|
||||
``detect_shell`` pokes around the process's running environment to determine
|
||||
what shell it is run in. It returns a 2-tuple:
|
||||
|
||||
* The shell name, always lowercased.
|
||||
* The command used to run the shell.
|
||||
|
||||
``ShellDetectionFailure`` is raised if ``detect_shell`` fails to detect the
|
||||
surrounding shell.
|
||||
|
||||
|
||||
Notes
|
||||
=====
|
||||
|
||||
* The shell name is always lowercased.
|
||||
* On Windows, the shell name is the name of the executable, minus the file
|
||||
extension.
|
||||
|
||||
|
||||
Notes for Application Developers
|
||||
================================
|
||||
|
||||
Remember, your application's user is not necessarily using a shell.
|
||||
Shellingham raises ``ShellDetectionFailure`` if there is no shell to detect,
|
||||
but *your application should almost never do this to your user*.
|
||||
|
||||
A practical approach to this is to wrap ``detect_shell`` in a try block, and
|
||||
provide a sane default on failure
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
try:
|
||||
shell = shellingham.detect_shell()
|
||||
except shellingham.ShellDetectionFailure:
|
||||
shell = provide_default()
|
||||
|
||||
|
||||
There are a few choices for you to choose from.
|
||||
|
||||
* The POSIX standard mandates the environment variable ``SHELL`` to refer to
|
||||
"the user's preferred command language interpreter". This is always available
|
||||
(even if the user is not in an interactive session), and likely the correct
|
||||
choice to launch an interactive sub-shell with.
|
||||
* A command ``sh`` is almost guaranteed to exist, likely at ``/bin/sh``, since
|
||||
several POSIX tools rely on it. This should be suitable if you want to run a
|
||||
(possibly non-interactive) script.
|
||||
* All versions of DOS and Windows have an environment variable ``COMSPEC``.
|
||||
This can always be used to launch a usable command prompt (e.g. `cmd.exe` on
|
||||
Windows).
|
||||
|
||||
Here's a simple implementation to provide a default shell
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import os
|
||||
|
||||
def provide_default():
|
||||
if os.name == 'posix':
|
||||
return os.environ['SHELL']
|
||||
elif os.name == 'nt':
|
||||
return os.environ['COMSPEC']
|
||||
raise NotImplementedError(f'OS {os.name!r} support not available')
|
22
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/RECORD
vendored
Normal file
22
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/RECORD
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
shellingham-1.5.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
shellingham-1.5.4.dist-info/LICENSE,sha256=84j9OMrRMRLB3A9mm76A5_hFQe26-3LzAw0sp2QsPJ0,751
|
||||
shellingham-1.5.4.dist-info/METADATA,sha256=GD2AIgo3STJieVc53TV8xbs_Sb05DMkZjVGA5UUaB_o,3461
|
||||
shellingham-1.5.4.dist-info/RECORD,,
|
||||
shellingham-1.5.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
shellingham-1.5.4.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
|
||||
shellingham-1.5.4.dist-info/top_level.txt,sha256=uKMQL5AKxPi4O9_Rbd838QeEs4ImpGQKNbEDZYqgBgk,12
|
||||
shellingham-1.5.4.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
||||
shellingham/__init__.py,sha256=pAKXUPKUdwyErC0ZjS-5w-fRdSbmdcfvnpt_x1yWqtA,635
|
||||
shellingham/__pycache__/__init__.cpython-311.pyc,,
|
||||
shellingham/__pycache__/_core.cpython-311.pyc,,
|
||||
shellingham/__pycache__/nt.cpython-311.pyc,,
|
||||
shellingham/_core.py,sha256=v-CTr_7F7cJAtNnzpa1N_Hl8afkY5yiDA4joGmsUBu0,300
|
||||
shellingham/nt.py,sha256=m6J6SuwyqVVlxXT9Bc-9F_1x-T5u0gCFFrRAF2LIkeg,4516
|
||||
shellingham/posix/__init__.py,sha256=pB69qtvZJ_yIf48nl4-ZfS3wLwwuXuknXOZhBnC2T1o,3129
|
||||
shellingham/posix/__pycache__/__init__.cpython-311.pyc,,
|
||||
shellingham/posix/__pycache__/_core.cpython-311.pyc,,
|
||||
shellingham/posix/__pycache__/proc.cpython-311.pyc,,
|
||||
shellingham/posix/__pycache__/ps.cpython-311.pyc,,
|
||||
shellingham/posix/_core.py,sha256=_v18UaXbzr4muNhr3-mH1FdSdjZ_dOXQrtUyomIbKYQ,81
|
||||
shellingham/posix/proc.py,sha256=nSUxIuQSotvaDW76i0oTQAM9aZ9PXBLFAEktWljSKCo,2659
|
||||
shellingham/posix/ps.py,sha256=NGmDKCukhNp0lahwYCaMXphBYaVbhbiR9BtE0OkT8qU,1770
|
0
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/REQUESTED
vendored
Normal file
0
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/REQUESTED
vendored
Normal file
6
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/WHEEL
vendored
Normal file
6
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/WHEEL
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.41.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/top_level.txt
vendored
Normal file
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/top_level.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
shellingham
|
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/zip-safe
vendored
Normal file
1
env/lib/python3.11/site-packages/shellingham-1.5.4.dist-info/zip-safe
vendored
Normal file
@ -0,0 +1 @@
|
||||
|
Reference in New Issue
Block a user