Files
pipenv/tasks/vendoring/patches/vendor/yaspin-signal-handling.patch
Dan Ryan 4dac167657 Vendor boltons
Signed-off-by: Dan Ryan <dan@danryan.co>

Update vendored dependencies

Signed-off-by: Dan Ryan <dan@danryan.co>

Fix file handle leaks

- Fix #3020
- Fix #3088
- Patch delegator
- Add weakref finalizer for tempfiles

Signed-off-by: Dan Ryan <dan@danryan.co>

Fix spinner handlers on windows

Signed-off-by: Dan Ryan <dan@danryan.co>

Fix spinner output and encoding issue

Signed-off-by: Dan Ryan <dan@danryan.co>

fix encoding

Signed-off-by: Dan Ryan <dan@danryan.co>

Fix unicode output on windows, fix tomlkit imports

Signed-off-by: Dan Ryan <dan@danryan.co>

Unvendor boltons, fix compatibility, update merge functionalities

Signed-off-by: Dan Ryan <dan@danryan.co>

Update pythonfinder, vistir version, requirementslib version

Signed-off-by: Dan Ryan <dan@danryan.co>

Fix vendoring script

Signed-off-by: Dan Ryan <dan@danryan.co>

Silence pip version checks

Signed-off-by: Dan Ryan <dan@danryan.co>

Add debugging to locking

Signed-off-by: Dan Ryan <dan@danryan.co>
2018-10-30 01:07:07 -04:00

63 lines
2.0 KiB
Diff

diff --git a/pipenv/vendor/yaspin/core.py b/pipenv/vendor/yaspin/core.py
index d01fb98e..06b8b621 100644
--- a/pipenv/vendor/yaspin/core.py
+++ b/pipenv/vendor/yaspin/core.py
@@ -16,6 +16,9 @@ import sys
import threading
import time
+import colorama
+import cursor
+
from .base_spinner import default_spinner
from .compat import PY2, basestring, builtin_str, bytes, iteritems, str
from .constants import COLOR_ATTRS, COLOR_MAP, ENCODING, SPINNER_ATTRS
@@ -23,6 +26,9 @@ from .helpers import to_unicode
from .termcolor import colored
+colorama.init()
+
+
class Yaspin(object):
"""Implements a context manager that spawns a thread
to write spinner frames into a tty (stdout) during
@@ -369,11 +375,14 @@ class Yaspin(object):
# SIGKILL cannot be caught or ignored, and the receiving
# process cannot perform any clean-up upon receiving this
# signal.
- if signal.SIGKILL in self._sigmap.keys():
- raise ValueError(
- "Trying to set handler for SIGKILL signal. "
- "SIGKILL cannot be cought or ignored in POSIX systems."
- )
+ try:
+ if signal.SIGKILL in self._sigmap.keys():
+ raise ValueError(
+ "Trying to set handler for SIGKILL signal. "
+ "SIGKILL cannot be cought or ignored in POSIX systems."
+ )
+ except AttributeError:
+ pass
for sig, sig_handler in iteritems(self._sigmap):
# A handler for a particular signal, once set, remains
@@ -521,14 +530,12 @@ class Yaspin(object):
@staticmethod
def _hide_cursor():
- sys.stdout.write("\033[?25l")
- sys.stdout.flush()
+ cursor.hide()
@staticmethod
def _show_cursor():
- sys.stdout.write("\033[?25h")
- sys.stdout.flush()
+ cursor.show()
@staticmethod
def _clear_line():
- sys.stdout.write("\033[K")
+ sys.stdout.write(chr(27) + "[K")