def uninstall_package(self, with_custom_actions=True):
     properties = self._get_installed_product_from_registry()['InstallProperties'].values_store
     uninstall_string = properties['UninstallString'].to_python_object()
     args = uninstall_string.split() + ['/passive']
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     execute_assert_success(args)
Beispiel #2
0
 def uninstall_package(self, with_custom_actions=True):
     # with_custom_actions is actually ignored here. This flag is passed to the installer through the response file.
     # Luckily, the preremove scripts also gets this info (it's saved somwhere in the os until the removal)
     execute_assert_success(
         ['pkgrm', '-n', '-a', self.admin_file.name, self.package_name],
         allowed_return_codes=[
             0,
         ])
Beispiel #3
0
 def install_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     env['LIBPATH'] = ''  # On AIX we don't want Python's LIBPATH for rpm
     with prevent_access_to_pypi_servers(), prevent_access_to_gcc():
         execute_assert_success(
             ['rpm', '-Uvh', self.get_package()], env=env)
 def execute_with_isolated_python(self, commandline_or_args):
     import sys
     import os
     from infi.recipe.application_packager.utils.execute import execute_assert_success, parse_args
     from infi.recipe.application_packager.assertions import is_windows
     args = parse_args(commandline_or_args)
     executable = [os.path.join(self.buildout_directory, 'parts', 'python', 'bin',
                                'python{}'.format('.exe' if is_windows() else ''))]
     env = os.environ.copy()
     env['PYTHONPATH'] = os.path.pathsep.join([path for path in sys.path])
     execute_assert_success(executable + args, env=env)
Beispiel #5
0
 def install_package(self, with_custom_actions=True):
     logfile = self.get_package() + '.install.log'
     with open(logfile, 'w'):
         pass
     args = ['msiexec', '/i', self.get_package(), '/passive', '/l*vx', logfile]
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     with prevent_access_to_pypi_servers():
         try:
             execute_assert_success(args)
         finally:
             with open(logfile) as fd:
                 print(fd.read())
def execute_with_isolated_python(buildout_directory, commandline_or_args,
                                 **kwargs):
    import sys
    import os
    from infi.recipe.application_packager.utils.execute import execute_assert_success, parse_args
    from infi.recipe.application_packager.assertions import is_windows
    args = parse_args(commandline_or_args)
    executable = [
        os.path.join(buildout_directory, 'parts', 'python', 'bin',
                     'python{}'.format('.exe' if is_windows() else ''))
    ]
    env = kwargs.pop('env', os.environ.copy())
    env['PYTHONPATH'] = ''
    execute_assert_success(executable + args, env=env, **kwargs)
Beispiel #7
0
 def uninstall_package(self, with_custom_actions=True):
     logfile = self.get_package() + '.uninstall.log'
     with open(logfile, 'w'):
         pass
     properties = self._get_installed_product_from_registry()['InstallProperties'].values_store
     uninstall_string = properties['UninstallString'].to_python_object()
     args = uninstall_string.split() + ['/passive', '/l*vx', logfile]
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     try:
         execute_assert_success(args)
     finally:
         with open(logfile) as fd:
             print(fd.read())
Beispiel #8
0
 def install_package(self, with_custom_actions=True):
     response_file = NamedTemporaryFile(mode='w')
     response_file.write("NO_CUSTOM_ACTIONS={}".format(int(not with_custom_actions)))
     response_file.flush()
     os.fsync(response_file.fileno())
     with prevent_access_to_pypi_servers(), prevent_access_to_gcc():
         zipped_package_name = self.get_package()
         unzipped_package_name = zipped_package_name[:-3]
         execute_assert_success('gunzip -c {} > {}'.format(zipped_package_name, unzipped_package_name), shell=True)
         execute_assert_success(['pkgadd',
                                 '-n',
                                 '-a', self.admin_file.name,
                                 '-r', response_file.name,
                                 '-d', unzipped_package_name,
                                 self.package_name])
Beispiel #9
0
 def uninstall_package(self, with_custom_actions=True):
     import io
     logfile = self.get_package() + '.uninstall.log'
     with open(logfile, 'w'):
         pass
     properties = self._get_installed_product_from_registry(
     )['InstallProperties'].values_store
     uninstall_string = properties['UninstallString'].to_python_object()
     args = uninstall_string.split() + ['/passive', '/l*vx', logfile]
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     try:
         execute_assert_success(args)
     finally:
         with io.open(logfile, encoding='utf-16') as fd:
             print(fd.read())
 def create_package(self):
     from ..utils import chdir
     with chdir(os.path.dirname(self._buildout_path)):
         python = os.path.join('bin', 'python{}'.format('.exe' if os.name == 'nt' else ''))
         buildout_script = os.path.join('bin', 'buildout{}'.format('-script.py' if os.name == 'nt' else ''))
         stdout = execute_assert_success([python, buildout_script, '-v', 'install', 'pack']).get_stdout()
         log.debug('package created, stdout: {}'.format(stdout))
Beispiel #11
0
 def install_package(self, with_custom_actions=True):
     import io
     logfile = self.get_package() + '.install.log'
     with open(logfile, 'w'):
         pass
     args = [
         'msiexec', '/i',
         self.get_package(), '/passive', '/l*vx', logfile
     ]
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     with prevent_access_to_pypi_servers():
         try:
             execute_assert_success(args)
         finally:
             with io.open(logfile, encoding='utf-16') as fd:
                 print(fd.read())
Beispiel #12
0
 def is_product_installed(self):
     output = execute_assert_success(
         ["dpkg", "--list", self.package_name],
         allowed_return_codes=[0, 1]).get_stdout().splitlines()
     return any([
         line.startswith(b'ii')
         and self.package_name in line.decode('ascii') for line in output
     ])
Beispiel #13
0
 def install_package(self, with_custom_actions=True):
     response_file = NamedTemporaryFile(mode='w')
     response_file.write("NO_CUSTOM_ACTIONS={}".format(
         int(not with_custom_actions)))
     response_file.flush()
     os.fsync(response_file.fileno())
     with prevent_access_to_pypi_servers(), prevent_access_to_gcc():
         zipped_package_name = self.get_package()
         unzipped_package_name = zipped_package_name[:-3]
         execute_assert_success('gunzip -c {} > {}'.format(
             zipped_package_name, unzipped_package_name),
                                shell=True)
         execute_assert_success([
             'pkgadd', '-n', '-a', self.admin_file.name, '-r',
             response_file.name, '-d', unzipped_package_name,
             self.package_name
         ])
Beispiel #14
0
 def create_package(self):
     from ..utils import chdir
     with chdir(os.path.dirname(self._buildout_path)):
         python = os.path.join(
             'bin', 'python{}'.format('.exe' if os.name == 'nt' else ''))
         buildout_script = os.path.join(
             'bin',
             'buildout{}'.format('-script.py' if os.name == 'nt' else ''))
         stdout = execute_assert_success(
             [python, buildout_script, '-v', 'install',
              'pack']).get_stdout()
         log.debug('package created, stdout: {}'.format(stdout))
Beispiel #15
0
def set_icon_in_executable(executable, icon):
    from pkg_resources import resource_filename
    from infi.recipe.application_packager.utils.execute import execute_assert_success
    rcedit = resource_filename(__name__, "rcedit.exe")
    execute_assert_success([rcedit, executable, '--set-icon', icon])
Beispiel #16
0
 def create_package(self):
     from ..utils import chdir
     with chdir(os.path.dirname(self._buildout_path)):
         stdout = execute_assert_success([os.path.join('bin', 'buildout'), '-v', 'install', 'pack']).get_stdout()
         log.debug('package created, stdout: {}'.format(stdout))
 def is_product_installed(self):
     return not 'not installed' in execute_assert_success(['rpm', '-q', self.package_name],
                                                      allowed_return_codes=[0, 1]).get_stdout()
Beispiel #18
0
 def install_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     with prevent_access_to_pypi_servers(), prevent_access_to_gcc():
         execute_assert_success(['dpkg', '-i', self.get_package()], env=env)
Beispiel #19
0
 def uninstall_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     execute_assert_success(['dpkg', '-r', self.package_name], env=env)
Beispiel #20
0
 def install_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     with prevent_access_to_pypi_servers(), prevent_access_to_gcc():
         execute_assert_success(['dpkg', '-i', self.get_package()], env=env)
Beispiel #21
0
 def uninstall_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     env['LIBPATH'] = ''  # On AIX we don't want Python's LIBPATH for rpm
     execute_assert_success(['rpm', '-e', self.package_name], env=env)
Beispiel #22
0
 def is_product_installed(self):
     pid = execute_assert_success(['rpm', '-q', self.package_name], allowed_return_codes=[0, 1])
     output = pid.get_stderr() + pid.get_stdout()
     return 'not installed' not in output
Beispiel #23
0
 def is_product_installed(self):
     output = execute_assert_success(["dpkg", "--list", self.package_name], allowed_return_codes=[0, 1]).get_stdout().splitlines()
     return any([line.startswith(b'ii') and self.package_name in line.decode('ascii') for line in output])
 def create_package(self):
     from ..utils import chdir
     with chdir(os.path.dirname(self._buildout_path)):
         execute_assert_success([os.path.join('bin', 'buildout'), '-v', '-s' ,'install', 'pack'])
Beispiel #25
0
 def uninstall_package(self, with_custom_actions=True):
     env = os.environ.copy()
     if not with_custom_actions:
         env['NO_CUSTOM_ACTIONS'] = '1'
     execute_assert_success(['dpkg', '-r', self.package_name], env=env)
 def install_package(self, with_custom_actions=True):
     args = ['msiexec', '/i', self.get_package(), '/passive']
     if not with_custom_actions:
         args.append("NO_CUSTOM_ACTIONS=1")
     with prevent_access_to_pypi_servers():
         execute_assert_success(args)
Beispiel #27
0
 def uninstall_package(self, with_custom_actions=True):
     # with_custom_actions is actually ignored here. This flag is passed to the installer through the response file.
     # Luckily, the preremove scripts also gets this info (it's saved somwhere in the os until the removal)
     execute_assert_success(['pkgrm', '-n', '-a', self.admin_file.name, self.package_name], allowed_return_codes=[0,])
Beispiel #28
0
 def is_product_installed(self):
     pid = execute_assert_success(['rpm', '-q', self.package_name],
                                  allowed_return_codes=[0, 1])
     output = pid.get_stderr() + pid.get_stdout()
     return b'not installed' not in output