Example #1
0
 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
Example #2
0
 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
Example #3
0
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)
Example #4
0
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)
Example #5
0
    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', )
Example #6
0
    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',)
Example #7
0
            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)
Example #8
0
    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()
Example #9
0
        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')
Example #10
0
            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)