def _execute(self, options, args): """Install theme into current site.""" listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if options['getpath'] and name: path = utils.get_theme_path(name) if path: print(path) else: print('not installed') return 0 if name is None and not listing: LOGGER.error( "This command needs either a theme name or the -l option.") return False try: data = requests.get(url).json() except requests.exceptions.SSLError: LOGGER.warning( "SSL error, using http instead of https (press ^C to abort)") time.sleep(1) url = url.replace('https', 'http', 1) data = requests.get(url).json() if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice( 'Remember to set THEME="{0}" in conf.py to use this theme.' .format(origname))
def _execute(self, options, args): """Install theme into current site.""" listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if options['getpath'] and name: path = utils.get_theme_path(name) if path: print(path) else: print('not installed') return 0 if name is None and not listing: LOGGER.error("This command needs either a theme name or the -l option.") return False try: data = requests.get(url).json() except requests.exceptions.SSLError: LOGGER.warning("SSL error, using http instead of https (press ^C to abort)") time.sleep(1) url = url.replace('https', 'http', 1) data = requests.get(url).json() if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
def _execute(self, options, args): """Install theme into current site.""" listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if options['getpath'] and name: path = utils.get_theme_path(name) if path: print(path) else: print('not installed') exit(0) if name is None and not listing: LOGGER.error( "This command needs either a theme name or the -l option.") return False data = requests.get(url).text data = json.loads(data) if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice( 'Remember to set THEME="{0}" in conf.py to use this theme.' .format(origname))
def _execute(self, options, args): """Install theme into current site.""" listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if options['getpath'] and name: path = utils.get_theme_path(name) if path: print(path) else: print('not installed') exit(0) if name is None and not listing: LOGGER.error("This command needs either a theme name or the -l option.") return False data = requests.get(url).text data = json.loads(data) if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
def do_install_deps(self, url, name): """Install themes and their dependencies.""" data = self.get_json(url) # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(utils.get_theme_path_real(name, self.site.themes_dirs)) if parent_name is None: break try: utils.get_theme_path_real(parent_name, self.site.themes_dirs) break except: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
def do_install_deps(self, url, name): """Install themes and their dependencies.""" data = self.get_json(url) # `name` may be modified by the while loop. origname = name installstatus = self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(utils.get_theme_path_real(name, self.site.themes_dirs)) if parent_name is None: break try: utils.get_theme_path_real(parent_name, self.site.themes_dirs) break except Exception: # Not available self.do_install(parent_name, data) name = parent_name if installstatus: LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
def _execute(self, options, args): """Install theme into current site.""" if requests is None: utils.LOGGER.error('This command requires the requests package be installed.') return False listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if name is None and not listing: utils.LOGGER.error("This command needs either a theme name or the -l option.") return False data = requests.get(url).text data = json.loads(data) if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name
def _execute(self, options, args): """Install theme into current site.""" if requests is None: utils.req_missing(['requests'], 'install themes') listing = options['list'] url = options['url'] if args: name = args[0] else: name = None if name is None and not listing: LOGGER.error( "This command needs either a theme name or the -l option.") return False data = requests.get(url).text data = json.loads(data) if listing: print("Themes:") print("-------") for theme in sorted(data.keys()): print(theme) return True else: self.do_install(name, data) # See if the theme's parent is available. If not, install it while True: parent_name = utils.get_parent_theme_name(name) if parent_name is None: break try: utils.get_theme_path(parent_name) break except: # Not available self.do_install(parent_name, data) name = parent_name