Exemple #1
0
    def test_restore_original_package_version_file_restores_correctly(self):
        def fake_os_rename(source_file_path, target_file_path):
            # Store the args the first time rename is called so we can use these values in later asserts.
            nonlocal original_pkg_ver_path, backup_pkg_ver_path
            if None in (original_pkg_ver_path, backup_pkg_ver_path):
                original_pkg_ver_path = source_file_path
                backup_pkg_ver_path = target_file_path

        original_pkg_ver_path = None
        backup_pkg_ver_path = None
        self.patch('app.util.autoversioning.fs')
        mock_os = self.patch('app.util.autoversioning.os')
        mock_os.rename.side_effect = fake_os_rename

        autoversioning.write_package_version_file(
            package_version_string='1.2.3')
        autoversioning.restore_original_package_version_file()

        backup_os_rename_call = call.rename(original_pkg_ver_path,
                                            backup_pkg_ver_path)
        restore_os_rename_call = call.rename(backup_pkg_ver_path,
                                             original_pkg_ver_path)
        self.assertLess(
            mock_os.method_calls.index(backup_os_rename_call),
            mock_os.method_calls.index(restore_os_rename_call),
            'restore_original_package_version_file() should restore whatever file was backed up in the '
            'previous call to write_package_version_file().')
    def test_restore_original_package_version_file_restores_correctly(self):
        def fake_os_rename(source_file_path, target_file_path):
            # Store the args the first time rename is called so we can use these values in later asserts.
            nonlocal original_pkg_ver_path, backup_pkg_ver_path
            if None in (original_pkg_ver_path, backup_pkg_ver_path):
                original_pkg_ver_path = source_file_path
                backup_pkg_ver_path = target_file_path

        original_pkg_ver_path = None
        backup_pkg_ver_path = None
        self.patch('app.util.autoversioning.fs')
        mock_os = self.patch('app.util.autoversioning.os')
        mock_os.rename.side_effect = fake_os_rename

        autoversioning.write_package_version_file(package_version_string='1.2.3')
        autoversioning.restore_original_package_version_file()

        backup_os_rename_call = call.rename(original_pkg_ver_path, backup_pkg_ver_path)
        restore_os_rename_call = call.rename(backup_pkg_ver_path, original_pkg_ver_path)
        self.assertLess(mock_os.method_calls.index(backup_os_rename_call),
                        mock_os.method_calls.index(restore_os_rename_call),
                        'restore_original_package_version_file() should restore whatever file was backed up in the '
                        'previous call to write_package_version_file().')
Exemple #3
0
    bin_includes = ['/usr/lib64/libssl.so.10', '/usr/lib64/libcrypto.so.10']
    file_exists = [os.path.isfile(filename) for filename in bin_includes]

    if all(file_exists):
        buildOptions['bin_includes'] = bin_includes

version = autoversioning.get_version()
autoversioning.write_package_version_file(version)

setup(name='ClusterRunner',
      version=version,
      description='',
      options=dict(build_exe=buildOptions),
      executables=executables)

autoversioning.restore_original_package_version_file()

if sys.platform == 'darwin':
    # Fix a cx_freeze issue on mac.
    # (See similar fix at https://bitbucket.org/iep-project/iep/commits/1e845c0f35)
    abs_python_path = None
    clusterrunner_path = join(dirname(__file__), 'dist', executable_name)

    # Get the Python reference in clusterrunner
    otool_proc = subprocess.Popen(('otool', '-L', clusterrunner_path),
                                  stdout=subprocess.PIPE)
    clusterrunner_libs = otool_proc.stdout.readlines()
    for lib in clusterrunner_libs[1:]:
        lib = lib.decode().strip()
        lib_filename, _ = lib.split(maxsplit=1)
        if lib_filename.endswith('/Python'):
Exemple #4
0
    bin_includes = ['/usr/lib64/libssl.so.10', '/usr/lib64/libcrypto.so.10']
    file_exists = [os.path.isfile(filename) for filename in bin_includes]

    if all(file_exists):
        buildOptions['bin_includes'] = bin_includes

version = autoversioning.get_version()
autoversioning.write_package_version_file(version)

setup(name='ClusterRunner',
      version=version,
      description='',
      options=dict(build_exe=buildOptions),
      executables=executables)

autoversioning.restore_original_package_version_file()

if sys.platform == 'darwin':
    # Fix a cx_freeze issue on mac.
    # (See similar fix at https://bitbucket.org/iep-project/iep/commits/1e845c0f35)
    abs_python_path = None
    clusterrunner_path = join(dirname(__file__), 'dist', executable_name)

    # Get the Python reference in clusterrunner
    otool_proc = subprocess.Popen(('otool', '-L', clusterrunner_path), stdout=subprocess.PIPE)
    clusterrunner_libs = otool_proc.stdout.readlines()
    for lib in clusterrunner_libs[1:]:
        lib = lib.decode().strip()
        lib_filename, _ = lib.split(maxsplit=1)
        if lib_filename.endswith('/Python'):
            abs_python_path = lib_filename