File: check_installed.py

package info (click to toggle)
python-maturin 1.9.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,540 kB
  • sloc: python: 656; javascript: 93; sh: 55; makefile: 10
file content (33 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (2)
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
import locale
import sys
from pathlib import Path

import with_data

assert with_data.lib.one() == 1
assert with_data.ffi.string(with_data.lib.say_hello()).decode() == "hello"

venv_root = Path(sys.prefix)

installed_data = (
    venv_root.joinpath("data_subdir")
    .joinpath("hello.txt")
    # With the default encoding, python under windows fails to read the file correctly
    .read_text(encoding="utf-8")
    .strip()
)
assert installed_data == "Hi! 😊", (
    installed_data,
    "Hi! 😊",
    locale.getpreferredencoding(),
)
header_file = (
    venv_root.joinpath("include")
    .joinpath("site")
    .joinpath(f"python{sys.version_info.major}.{sys.version_info.minor}")
    .joinpath("with-data")
    .joinpath("empty.h")
)
assert header_file.is_file(), header_file

print("SUCCESS")