import subprocess
from .base import DeweyCommand
from dewey.util import suppress_stdout_stderr

class Command(DeweyCommand):

    def pre_default(self, *args, **kwargs):
        return "printf 'Upgrading dewey...'"

    def run_command(self, *args, **kwargs):
            try:
                with suppress_stdout_stderr():
                    output = subprocess.check_output("pip install git+https://git@github.com/buddyup/dewey.git#egg=dewey --upgrade", shell=True,)
                print(" complete.")
            except subprocess.CalledProcessError as grepexc:                                                                                                   
                print("\nError upgrading dewey. \n%s" % (grepexc.output,))


    def post_default(self, *args, **kwargs):
        # return "printf ' complete.\n'"
        pass

@@ -205,19 +205,20 @@
 dewey...
+ 
 '%22%0A
-
 %0A    def
@@ -487,17 +487,16 @@
  print(%22
- 
 complete
@@ -736,16 +736,16 @@
 ut,))%0A%0A%0A
+
     def 
@@ -785,49 +785,8 @@
 s):%0A
-        # return %22printf ' complete.%5Cn'%22%0A
     

Clean and clear