Esempio n. 1
0
    def test_with_spaces(self, monkeypatch, mock_local):
        monkeypatch.setattr('sys.executable', '/some/python.py')

        local_venv = '/local path/venv'
        remote_venv = '/remote path/venv'
        assert not mock_local.called
        virtualenv.patch_virtualenv(local_venv, remote_venv)
        assert mock_local.mock_calls == [
            mock.call("prelink -u '/local path/venv/bin/python'"),
            mock.call("/some/python.py -m virtualenv --relocatable "
                      "'/local path/venv'"),
            mock.call('sed -i "s:/local path/venv:/remote path/venv:" '
                      "'/local path/venv/bin/activate'"),
        ]
Esempio n. 2
0
def fpm(manifest_path, requirements_file_path=None, setup_py_path=None,
        **overrides):
    manifest = get_manifest_from_path(manifest_path)
    if requirements_file_path is None:
        requirements_file_path = path.join(manifest.manifest_dir,
                                           'requirements.txt')
    if setup_py_path is None:
        setup_py_path = path.join(manifest.manifest_dir, 'setup.py')

    validate_path(manifest.path)

    _package_virtualenv_with_manifest(manifest, requirements_file_path,
                                      setup_py_path)
    virtualenv.patch_virtualenv(manifest.local_virtualenv_path,
                                manifest.remote_virtualenv_path)

    man_args, man_flags = manifest.get_args_and_flags()
    man_flags.extend(overrides.items())
    command_line = cli.get_command_line(man_args, man_flags)

    cli.invoke_fpm(command_line)