Best Python code snippet using lisa_python
setup.py
Source:setup.py
...13 'uwsgi',14 'uwsgi-plugin-python',15 ]1617 _install_packages(base_packages)18 if setup_wins:19 _setup_wins()2021 username = run('echo $USER')2223 sudo('addgroup webadmin')24 sudo('adduser {0} webadmin'.format(username))2526 sudo('mkdir /etc/nginx/ssl')27 sudo('mkdir /var/www')28 sudo('mkdir /var/www/python')29 sudo('chgrp -R webadmin /var/www')30 sudo('chmod -R ug+w /var/www')3132 sudo('createuser -E -P -s {0}'.format(username), user='postgres')33 run('createuser -s root')3435 sudo('mkdir /var/uwsgi')36 sudo('chmod 777 /var/uwsgi')37 sudo('rm /etc/nginx/sites-enabled/default')38 sudo('/etc/init.d/nginx start')394041def _install_packages(packages):42 for package in packages:43 sudo('apt-get install --yes {0}'.format(package))444546def _setup_wins():47 wins_packages = [48 'samba',49 'winbind',50 ]5152 _install_packages(wins_packages)53 sudo('sed -i s/\'hosts:.*/hosts: files dns wins/\' /etc/nsswitch.conf')545556def setup_deployment(config, repo):57 PYTHON_DIR = '/var/www/python'58 repo_dir = '{0}/guidcoin-{1}'.format(PYTHON_DIR, config)5960 with cd(PYTHON_DIR):61 run('git clone {0} guidcoin-{1}'.format(repo, config))6263 with cd(repo_dir):64 run('virtualenv --system-site-packages venv')6566 deploy(config)
gc_install_pkg.py
Source:gc_install_pkg.py
...4 def handle(self, *args, **kwargs):5 for host in self.hosts(args):6 with fabric.api.settings(host_string=host):7 self._upgrade()8 self._install_packages()9 def _upgrade(self):10 '''Install any pending updates (we assume that some cron11 job is doing "apt-get update" once in a while).12 '''13 fabric.api.sudo('apt-get dist-upgrade -y')14 def _install_packages(self):15 host_config = self.host_config()16 fabric.api.sudo('apt-get install -y ' + ' '.join(host_config['apt_packages']))...
install_cmd.py
Source:install_cmd.py
2import guild.source3import guild.source_cmd_support4def main(args):5 pkgs = guild.source_cmd_support.resolve_all_packages(args.packages)6 _install_packages(pkgs)7def _install_packages(pkgs):8 for pkg in pkgs:9 _install_package(pkg)10def _install_package(pkg):11 try:12 guild.source.install_pkg(pkg)13 except guild.source.MissingSourcesError:14 guild.cli.out(15 "%s is not configured with sources, skipping"16 % pkg.key, err=True)17 except guild.source.AlreadyInstalled:18 guild.cli.out(19 "%s is already installed"...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!