def remove(self, value, warn=True): new = Dependency(value) old = self.dependencies.get(new.name) new_label = new.to_stdout() if old is not None: old_label = old.to_stdout() self.dependencies.pop(new.name) self._save() stdout.write(red('- ') + old_label) return True else: if warn: stdout.write('%s %s' % (new_label, yellow('not installed.'))) return False
def info(): """Display app info. Examples: $ django info No application, try running django init. $ django info Application: foo @ 2.7.9 Requirements: Django == 1.10 """ application = get_current_application() info = application.info() stdout.write(info) return info
def install_runtime(version): if version == 'system': # use system python version if 'virtualenv' not in execute('pip list', capture=True): execute('pip install -U virtualenv') else: # use pyenv to manage versions install_pyenv_dependencies() versions = execute('pyenv versions', capture=True) root = get_runtime_root(version) if version not in versions: stdout.write(format_command('Installing', version)) execute('PYTHON_CONFIGURE_OPTS="--enable-shared" ' 'pyenv install %s' % version, verbose=True) if 'virtualenv' not in execute('%s/bin/pip list' % root, capture=True): execute('%s/bin/pip install -U virtualenv' % root)
def install_pyenv_dependencies(update=False): if not exists("brew"): stdout.write(format_command('Installing', 'brew')) execute( 'ruby -e "$(curl -fsSL ' 'https://raw.githubusercontent.com' '/Homebrew/install/master/install', verbose=True) elif update: stdout.write(format_command('Updating', 'brew')) execute('brew update', verbose=True) if not exists('pyenv'): stdout.write(format_command('Installing', 'pyenv')) execute('brew install pyenv', verbose=True) elif update: stdout.write(format_command('Updating', 'pyenv')) execute('brew install --upgrade pyenv', verbose=True)
def add(self, value, warn=True): new = Dependency(value) new_label = new.to_stdout() old = self.dependencies.get(new.name) self.dependencies[new.name] = new if old is None or str(old) != str(new): old_label = old.to_stdout() if old else '' self._save() if old_label: stdout.write(red('- ') + old_label) stdout.write(green('+ ') + new_label) return True else: if warn: stdout.write('%s %s' % (new_label, yellow('already installed.'))) return False
def version(): """Display application version.""" stdout.write(VERSION)