gstly 0.4.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. gstly-0.4.5/PKG-INFO +17 -0
  2. gstly-0.4.5/build.py +108 -0
  3. gstly-0.4.5/gstly/__init__.cpython-36m-x86_64-linux-gnu.so +0 -0
  4. gstly-0.4.5/gstly/__init__.cpython-38-x86_64-linux-gnu.so +0 -0
  5. gstly-0.4.5/gstly/errors.cpython-36m-x86_64-linux-gnu.so +0 -0
  6. gstly-0.4.5/gstly/errors.cpython-38-x86_64-linux-gnu.so +0 -0
  7. gstly-0.4.5/gstly/gobject_init.cpython-36m-x86_64-linux-gnu.so +0 -0
  8. gstly-0.4.5/gstly/gobject_init.cpython-38-x86_64-linux-gnu.so +0 -0
  9. gstly-0.4.5/gstly/logger.cpython-36m-x86_64-linux-gnu.so +0 -0
  10. gstly-0.4.5/gstly/logger.cpython-38-x86_64-linux-gnu.so +0 -0
  11. gstly-0.4.5/gstly/pipeline_factories/__init__.cpython-36m-x86_64-linux-gnu.so +0 -0
  12. gstly-0.4.5/gstly/pipeline_factories/__init__.cpython-38-x86_64-linux-gnu.so +0 -0
  13. gstly-0.4.5/gstly/pipeline_factories/base.cpython-36m-x86_64-linux-gnu.so +0 -0
  14. gstly-0.4.5/gstly/pipeline_factories/base.cpython-38-x86_64-linux-gnu.so +0 -0
  15. gstly-0.4.5/gstly/pipeline_factories/custom.cpython-36m-x86_64-linux-gnu.so +0 -0
  16. gstly-0.4.5/gstly/pipeline_factories/custom.cpython-38-x86_64-linux-gnu.so +0 -0
  17. gstly-0.4.5/gstly/pipeline_factories/http.cpython-36m-x86_64-linux-gnu.so +0 -0
  18. gstly-0.4.5/gstly/pipeline_factories/http.cpython-38-x86_64-linux-gnu.so +0 -0
  19. gstly-0.4.5/gstly/pipeline_factories/rtsp.cpython-36m-x86_64-linux-gnu.so +0 -0
  20. gstly-0.4.5/gstly/pipeline_factories/rtsp.cpython-38-x86_64-linux-gnu.so +0 -0
  21. gstly-0.4.5/gstly/stream_reader/__init__.cpython-36m-x86_64-linux-gnu.so +0 -0
  22. gstly-0.4.5/gstly/stream_reader/__init__.cpython-38-x86_64-linux-gnu.so +0 -0
  23. gstly-0.4.5/gstly/stream_reader/base.cpython-36m-x86_64-linux-gnu.so +0 -0
  24. gstly-0.4.5/gstly/stream_reader/base.cpython-38-x86_64-linux-gnu.so +0 -0
  25. gstly-0.4.5/gstly/stream_reader/gst.cpython-36m-x86_64-linux-gnu.so +0 -0
  26. gstly-0.4.5/gstly/stream_reader/gst.cpython-38-x86_64-linux-gnu.so +0 -0
  27. gstly-0.4.5/gstly/stream_reader/runtime_options.cpython-36m-x86_64-linux-gnu.so +0 -0
  28. gstly-0.4.5/gstly/stream_reader/runtime_options.cpython-38-x86_64-linux-gnu.so +0 -0
  29. gstly-0.4.5/gstly/stream_reader/test-results/junit.xml +1 -0
  30. gstly-0.4.5/gstly/utils/gstcallbacks.cpython-36m-x86_64-linux-gnu.so +0 -0
  31. gstly-0.4.5/gstly/utils/gstcallbacks.cpython-38-x86_64-linux-gnu.so +0 -0
  32. gstly-0.4.5/gstly/utils/gstreamer.cpython-36m-x86_64-linux-gnu.so +0 -0
  33. gstly-0.4.5/gstly/utils/gstreamer.cpython-38-x86_64-linux-gnu.so +0 -0
  34. gstly-0.4.5/gstly/utils/timing.cpython-36m-x86_64-linux-gnu.so +0 -0
  35. gstly-0.4.5/gstly/utils/timing.cpython-38-x86_64-linux-gnu.so +0 -0
  36. gstly-0.4.5/pyproject.toml +38 -0
gstly-0.4.5/PKG-INFO ADDED
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: gstly
3
+ Version: 0.4.5
4
+ Summary: Internal GStreamer libraries for BrainFrame
5
+ License: Proprietary
6
+ Author: Aotu
7
+ Requires-Python: >=3.6.2,<4.0.0
8
+ Classifier: License :: Other/Proprietary License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.7
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Dist: PyGObject (>=3.34.0,<4.0.0)
17
+ Requires-Dist: numpy (>=1.16,<2.0)
gstly-0.4.5/build.py ADDED
@@ -0,0 +1,108 @@
1
+ import multiprocessing
2
+ from pathlib import Path
3
+ from typing import List
4
+ import subprocess
5
+ import tempfile
6
+ import shutil
7
+ import platform
8
+
9
+ # This import must be run before Cython imports to avoid an AttributeError
10
+ from setuptools import Extension, Distribution
11
+
12
+ from Cython.Build import cythonize
13
+ from Cython.Distutils.build_ext import new_build_ext as cython_build_ext
14
+
15
+ SOURCE_DIR = Path("gstly")
16
+ BUILD_DIR = Path("cython_build")
17
+ C_EXTENSIONS_DIR = Path("extensions")
18
+ EXCLUDED_FILES = []
19
+ THREAD_COUNT = multiprocessing.cpu_count() * 2
20
+
21
+ # https://github.com/cython/cython/issues/2968
22
+ CYTHONIZE_INIT = True
23
+
24
+
25
+ def build() -> None:
26
+ # Collect and cythonize all files
27
+ extension_modules = cythonize_helper(get_extension_modules())
28
+
29
+ # Use setuptools to collect files
30
+ distribution = Distribution(
31
+ {"ext_modules": extension_modules, "cmdclass": {"build_ext": cython_build_ext}}
32
+ )
33
+
34
+ # Grab the build_ext command and copy all files back to source dir. This is
35
+ # done so that Poetry grabs the files during the next step in its build.
36
+ distribution.run_command("build_ext")
37
+ build_ext_cmd = distribution.get_command_obj("build_ext")
38
+ build_ext_cmd.copy_extensions_to_source()
39
+
40
+ build_c_extensions()
41
+
42
+
43
+ def build_c_extensions():
44
+ """Builds all hand-written C extensions in the extensions folder"""
45
+ for extension_path in C_EXTENSIONS_DIR.iterdir():
46
+ print(f"Building C extension {extension_path.name}...")
47
+
48
+ with tempfile.TemporaryDirectory() as build_dir:
49
+ subprocess.run(
50
+ ["meson", "setup", build_dir], cwd=extension_path, check=True
51
+ )
52
+ subprocess.run(["ninja"], cwd=Path(build_dir), check=True)
53
+
54
+ platform_system = platform.system()
55
+ suffix = "so" if platform.system() == "Linux" else "dll"
56
+ glob = f"{extension_path.name}*.{suffix}"
57
+
58
+ try:
59
+ print(f"Building {glob} for {platform_system}")
60
+ shared_library = next(Path(build_dir).glob(glob))
61
+ except StopIteration:
62
+ raise RuntimeError(
63
+ f"Missing shared library file for extension {extension_path.name}"
64
+ )
65
+ shutil.copy2(shared_library, Path("gstly/utils"))
66
+
67
+
68
+ def get_extension_modules() -> List[Extension]:
69
+ """Collect all .py files and turn them into Setuptools Extensions"""
70
+ extension_modules: List[Extension] = []
71
+
72
+ for py_file in SOURCE_DIR.rglob("*.py"):
73
+ if py_file.name == "__init__.py" and not CYTHONIZE_INIT:
74
+ continue
75
+
76
+ if py_file not in EXCLUDED_FILES:
77
+ # Get path (not just name) without .py extension
78
+ module_path = py_file.with_suffix("").as_posix()
79
+
80
+ # Convert path to module name
81
+ module_name = str(module_path).replace("/", ".")
82
+
83
+ extension_module = Extension(name=module_name, sources=[str(py_file)])
84
+
85
+ extension_modules.append(extension_module)
86
+
87
+ return extension_modules
88
+
89
+
90
+ def cythonize_helper(extension_modules: List[Extension]) -> List[Extension]:
91
+ """Cythonize all Python extensions"""
92
+ return cythonize(
93
+ extension_modules,
94
+ # Don't build in source tree (this leaves behind .c files)
95
+ build_dir=BUILD_DIR,
96
+ # No .html output file
97
+ annotate=False,
98
+ # Parallel build
99
+ nthreads=THREAD_COUNT,
100
+ # Python 3
101
+ compiler_directives={"language_level": "3"},
102
+ # Always rebuild, even if file untouched
103
+ force=True,
104
+ )
105
+
106
+
107
+ if __name__ == "__main__":
108
+ build()
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="0" time="0.009" timestamp="2022-12-09T20:10:48.005345" hostname="AOTU-001" /></testsuites>
@@ -0,0 +1,38 @@
1
+ [tool.poetry]
2
+ name = "gstly"
3
+ version = "0.4.5"
4
+ description = "Internal GStreamer libraries for BrainFrame"
5
+ authors = ["Aotu"]
6
+ license = "Proprietary"
7
+
8
+ # Only include cythonized files in final build
9
+ include = ["gstly/**/*.so"] # ignored in VCS, so we need to be explicit
10
+ exclude = ["gstly/**/*.py", "gstly/**/*.pyi"]
11
+
12
+ [tool.poetry.dependencies]
13
+ python = "^3.6.2,<4.0"
14
+ numpy = "^1.16"
15
+ PyGObject = "^3.34.0"
16
+
17
+ [tool.poetry.dev-dependencies]
18
+ # Match the version under [build-system]
19
+ Cython = "3.0a6"
20
+ black = "^21.5b2"
21
+ isort = "^5.8.0"
22
+ pre-commit = "^2.13.0"
23
+
24
+ [build-system]
25
+ requires = ["poetry-core>=1.0.0", "setuptools~=50.3.2", "Cython==3.0a6"]
26
+ build-backend = "poetry.core.masonry.api"
27
+
28
+ [tool.poetry.build]
29
+ # The allows us to build C extensions (using Cython). Unstable feature
30
+ # https://github.com/python-poetry/poetry/issues/2740#issuecomment-666551481
31
+ script = "build.py"
32
+ generate-setup-file = false
33
+
34
+ [tool.isort]
35
+ profile = "black"
36
+ src_paths = ["gstly"]
37
+ # build.py has sensitive import ordering
38
+ skip = ["build.py"]