How to use run_install_command method in tox

Best Python code snippet using tox_python

installbundle.py

Source: installbundle.py Github

copy

Full Screen

...63 if hasattr(app, 'splashScreen') and app.splashScreen:64 app.splashScreen.hide()65def shell_escape(arg):66 return '"%s"' % arg.replace('\\', '\\\\').replace('"', '\\"')67def run_install_command(graphical, cmd, args, as_root=True):68 if isinstance(args, str):69 cmd += ' %s' % shell_escape(args)70 elif isinstance(args, list):71 for package in args:72 if not isinstance(package, str):73 raise TypeError("Expected string or list of strings")74 cmd += ' %s' % shell_escape(package)75 else:76 raise TypeError("Expected string or list of strings")77 debug.warning("VisTrails wants to install package(s) %r" %78 args)79 if as_root and systemType != 'Windows':80 if graphical:81 sucmd, escape = guess_graphical_sudo()82 else:83 if get_executable_path('sudo'):84 sucmd, escape = "sudo %s", False85 elif systemType != 'Darwin':86 sucmd, escape = "su -c %s", True87 else:88 sucmd, escape = '%s', False89 if escape:90 cmd = sucmd % shell_escape(cmd)91 else:92 cmd = sucmd % cmd93 print "about to run: %s" % cmd94 p = subprocess.Popen(cmd, stdout=subprocess.PIPE,95 stderr=subprocess.STDOUT,96 shell=True)97 lines = []98 try:99 for line in iter(p.stdout.readline, ''):100 print line,101 lines.append(line)102 except IOError, e:103 print "Ignoring IOError:", str(e)104 result = p.wait()105 if result != 0:106 debug.critical("Error running: %s" % cmd, ''.join(lines))107 return result == 0 # 0 indicates success108def linux_debian_install(package_name):109 qt = qt_available()110 try:111 import apt112 import apt_pkg113 except ImportError:114 qt = False115 hide_splash_if_necessary()116 if qt:117 cmd = shell_escape(vistrails_root_directory() +118 '/​gui/​bundles/​linux_debian_install.py')119 else:120 cmd = '%s install -y' % ('aptitude'121 if executable_is_in_path('aptitude')122 else 'apt-get')123 return run_install_command(qt, cmd, package_name)124linux_ubuntu_install = linux_debian_install125def linux_fedora_install(package_name):126 qt = qt_available()127 hide_splash_if_necessary()128 if qt:129 cmd = shell_escape(vistrails_root_directory() +130 '/​gui/​bundles/​linux_fedora_install.py')131 else:132 cmd = 'yum -y install'133 return run_install_command(qt, cmd, package_name)134def pip_install(package_name):135 hide_splash_if_necessary()136 if executable_is_in_path('pip'):137 cmd = '%s install' % shell_escape(get_executable_path('pip'))138 else:139 cmd = shell_escape(sys.executable) + ' -m pip install'140 if systemType != 'Windows':141 use_root = True142 try:143 from distutils.sysconfig import get_python_lib144 f = get_python_lib()145 except Exception:146 f = sys.executable147 use_root = os.stat(f).st_uid == 0148 else:149 use_root = False150 return run_install_command(qt_available(), cmd, package_name, use_root)151def show_question(which_files, has_distro_pkg, has_pip):152 if isinstance(which_files, str):153 which_files = [which_files]154 if qt_available():155 from PyQt4 import QtCore, QtGui156 dialog = QtGui.QDialog()157 dialog.setWindowTitle("Required packages missing")158 layout = QtGui.QVBoxLayout()159 label = QtGui.QLabel(160 "One or more required packages are missing: %s. VisTrails can "161 "automatically install them. If you click OK, VisTrails will "162 "need administrator privileges, and you might be asked for "163 "the administrator password." % (" ".join(which_files)))164 label.setWordWrap(True)...

Full Screen

Full Screen

build_protobuf.py

Source: build_protobuf.py Github

copy

Full Screen

...19 self.run_debug_build_command()20 self.run_debug_install_command()21 self.run_configuration_script()22 self.run_build_command()23 self.run_install_command()24 self.verify()25 self.create_archive()26 @property27 def source_archives(self):28 return {29 f'{self.name}-all-{self.version}.tar.gz': f'https:/​/​github.com/​protocolbuffers/​protobuf/​releases/​download/​v{self.version}/​{self.name}-all-{self.version}.tar.gz'30 }31 @property32 def configuration_script(self):33 if not self.windows:34 return self.main_source_directory_path /​ 'configure'35 else:36 return Path(shutil.which('cmake'))37 @property38 def arguments_to_configuration_script(self):39 if not self.windows:40 return super().arguments_to_configuration_script + [41 '--disable-maintainer-mode',42 '--disable-static'43 ]44 return [45 '-G', self.visual_studio_generator_for_build,46 '-A', 'x64',47 '-DCMAKE_BUILD_TYPE=Release',48 f'-DCMAKE_INSTALL_PREFIX={self.install_directory}',49 '-Dprotobuf_BUILD_SHARED_LIBS=ON',50 f'{self.main_source_directory_path /​ "cmake"}'51 ]52 @property53 def arguments_to_debug_configuration_script(self):54 if not self.windows:55 raise Exception('debug is here for windows only')56 return [57 '-G', self.visual_studio_generator_for_build,58 '-A', 'x64',59 '-DCMAKE_BUILD_TYPE=Debug',60 f'-DCMAKE_INSTALL_PREFIX={self.install_directory}',61 '-Dprotobuf_BUILD_SHARED_LIBS=ON',62 f'{self.main_source_directory_path /​ "cmake"}'63 ]64 def run_debug_configuration_script(self):65 '''run the required commands to configure a package'''66 if not self.windows:67 raise Exception('debug is here for windows only')68 self.system(69 [str(self.configuration_script)] +70 self.arguments_to_debug_configuration_script,71 env=self.environment_for_configuration_script, cwd=self.build_directory_path)72 def run_build_command(self):73 if not self.windows:74 AutoconfMixin.run_build_command(self)75 else:76 CMakeMixin.run_build_command(self)77 def run_install_command(self):78 if not self.windows:79 AutoconfMixin.run_install_command(self)80 else:81 CMakeMixin.run_install_command(self)82 def run_debug_build_command(self):83 if not self.windows:84 raise Exception('debug is here for windows only')85 self.system([self.configuration_script, '--build', '.', '--config', 'Debug'],86 env=self.environment_for_build_command, cwd=self.build_directory_path)87 def run_debug_install_command(self):88 if not self.windows:89 raise Exception('debug is here for windows only')90 self.system([self.configuration_script, '--install', '.', '--config', 'Debug'],91 env=self.environment_for_build_command, cwd=self.build_directory_path)92def main():93 try:94 shutil.rmtree(ProtobufPackage().install_directory)95 except OSError:...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Test Managers in Agile – Creating the Right Culture for Your SQA Team

I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.

Complete Guide To Styling Forms With CSS Accent Color

The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).

A Complete Guide To Flutter Testing

Mobile devices and mobile applications – both are booming in the world today. The idea of having the power of a computer in your pocket is revolutionary. As per Statista, mobile accounts for more than half of the web traffic worldwide. Mobile devices (excluding tablets) contributed to 54.4 percent of global website traffic in the fourth quarter of 2021, increasing consistently over the past couple of years.

Webinar: Building Selenium Automation Framework [Voices of Community]

Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.

A Comprehensive Guide On JUnit 5 Extensions

JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful