File: conftest.py

package info (click to toggle)
python-briefcase 0.3.25-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,596 kB
  • sloc: python: 62,519; makefile: 60
file content (61 lines) | stat: -rw-r--r-- 2,161 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import pytest

from briefcase.platforms.linux.system import LinuxSystemCreateCommand

from ....utils import create_file


@pytest.fixture
def create_command(dummy_console, tmp_path):
    return LinuxSystemCreateCommand(
        console=dummy_console,
        base_path=tmp_path / "base_path",
        data_path=tmp_path / "briefcase",
    )


@pytest.fixture
def first_app(first_app_config, tmp_path):
    """A fixture for the first app, rolled out on disk."""
    # Specify a system python app for a dummy vendor
    first_app_config.target_vendor = "somevendor"
    first_app_config.target_codename = "surprising"
    first_app_config.target_vendor_base = "basevendor"

    # Targeted Python version
    first_app_config.python_version_tag = "3"

    # Some project-level files.
    create_file(tmp_path / "base_path/LICENSE", "First App License")
    create_file(tmp_path / "base_path/CHANGELOG", "First App Changelog")

    # Make it look like the template has been generated
    bundle_dir = tmp_path / "base_path/build/first-app/somevendor/surprising"

    create_file(bundle_dir / "first-app.1", "First App manpage")

    lib_dir = bundle_dir / "first-app-0.0.1/usr/lib/first-app"
    (lib_dir / "app").mkdir(parents=True, exist_ok=True)
    (lib_dir / "app_packages/firstlib").mkdir(parents=True, exist_ok=True)
    (lib_dir / "app_packages/secondlib").mkdir(parents=True, exist_ok=True)

    # Create some .so files
    # An SO file with different group and world permissions
    (lib_dir / "app/support.so").touch()
    (lib_dir / "app/support.so").chmod(0o775)

    # An SO file with same group and world permissions
    (lib_dir / "app/support_same_perms.so").touch()
    (lib_dir / "app/support_same_perms.so").chmod(0o744)

    # A SO file with both .so and .so.1.0 forms
    (lib_dir / "app_packages/firstlib/first.so").touch()
    (lib_dir / "app_packages/firstlib/first.so.1.0").touch()

    # An SO file with 664 permissions
    (lib_dir / "app_packages/secondlib/second_a.so").touch()
    (lib_dir / "app_packages/secondlib/second_a.so").chmod(0o664)

    (lib_dir / "app_packages/secondlib/second_b.so").touch()

    return first_app_config