def tmpdir(self, name): tempdirpath = os.path.join(tempfile.gettempdir(),name) if os.path.exists(tempdirpath): print("Directory %s already exists." % tempdirpath) if 'y' == input('Do you want to delete its contents and proceed? [y/n]'): shutil.rmtree(tempdirpath) else: print("Cannot install dependency.") exit(1) os.mkdir(tempdirpath) return tempdirpath
def bootstrap(): import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/N)\n") in ('y', 'yes'): inst = DependencyInstaller() inst.install_cherrypy() print('Successfully installed cherrymusic dependencies! You can now start cherrymusic.') else: sys.exit(1)
def bootstrap(): import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/N)\n") in ('y', 'yes'): inst = DependencyInstaller() inst.install_cherrypy() print( 'Successfully installed cherrymusic dependencies! You can now start cherrymusic.' ) else: sys.exit(1)
def _get_user_consent_for_db_schema_update(reasons): import textwrap wrap = lambda r: os.linesep.join( textwrap.wrap(r, initial_indent=' - ', subsequent_indent=" ")) msg = """ ========================================================================== A database schema update is needed and requires your consent. {reasons} To continue without changes, you need to downgrade to an earlier version of CherryMusic. To backup your database files first, abort for now and find them here: {dblocation} ========================================================================== Run schema update? [y/N]: """.format( reasons=(2 * os.linesep).join(wrap(r) for r in reasons), dblocation='\t' + pathprovider.databaseFilePath('')) return input(msg).lower().strip() in ('y', )
def _get_user_consent_for_db_schema_update(reasons): import textwrap wrap = lambda r: os.linesep.join( textwrap.wrap(r, initial_indent=' - ', subsequent_indent=" ")) msg = """ ========================================================================== A database schema update is needed and requires your consent. {reasons} To continue without changes, you need to downgrade to an earlier version of CherryMusic. To backup your database files first, abort for now and find them here: {dblocation} ========================================================================== Run schema update? [y/N]: """.format( reasons=(2 * os.linesep).join(wrap(r) for r in reasons), dblocation='\t' + pathprovider.databaseFilePath('')) return input(msg).lower().strip() in ('y',)
print("Directory %s already exists." % tempdirpath) if 'y' == input('Do you want to delete its contents and proceed? [y/n]'): shutil.rmtree(tempdirpath) else: print("Cannot install dependency.") exit(1) os.mkdir(tempdirpath) return tempdirpath def dl(self,url,target): with open(target, 'wb') as f: urlhandler = urllib.request.urlopen(urllib.request.Request(url)) f.write(urlhandler.read()) import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/n)") == 'y': inst = DependencyInstaller() inst.install_cherrypy() print('Successfully installed cherrymusic dependencies! You can now start cherrymusic.') else: sys.exit(1)
def dl(self,url,target): with open(target, 'wb') as f: urlhandler = urllib.request.urlopen(urllib.request.Request(url)) f.write(urlhandler.read()) import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/n)") == 'y': inst = DependencyInstaller() install_stagger = False #install stagger only for python 3 if sys.version_info >= (3,): try: import stagger except ImportError: print(""" You seem to be missing the optional module "stagger", an ID3-tag library. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which cherrymusic resides. """) install_stagger = bool(input("Download ID3-tag library stagger? (y/n)") == 'y') inst.install_cherrypy()
with open(target, 'wb') as f: urlhandler = urllib.request.urlopen(urllib.request.Request(url)) f.write(urlhandler.read()) import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/n)") == 'y': inst = DependencyInstaller() install_stagger = False #install stagger only for python 3 if sys.version_info >= (3, ): try: import stagger except ImportError: print(""" You seem to be missing the optional module "stagger", an ID3-tag library. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which cherrymusic resides. """) install_stagger = bool( input("Download ID3-tag library stagger? (y/n)") == 'y')
else: print("Cannot install dependency.") exit(1) os.mkdir(tempdirpath) return tempdirpath def dl(self, url, target): with open(target, 'wb') as f: urlhandler = urllib.request.urlopen(urllib.request.Request(url)) f.write(urlhandler.read()) import sys try: import cherrypy except ImportError: print(''' CherryMusic needs the module "cherrypy" to run. You should install it using the package manager of your OS. Alternatively cherrymusic can download it for you and put it in the folder in which currently CherryMusic resides. ''') if input("Download cherrypy now? (y/n)") == 'y': inst = DependencyInstaller() inst.install_cherrypy() print( 'Successfully installed cherrymusic dependencies! You can now start cherrymusic.' ) else: sys.exit(1)