diff --git a/deps/com.github.aiortc.aiortc b/deps/com.github.aiortc.aiortc index 857be4a..e6422d3 160000 --- a/deps/com.github.aiortc.aiortc +++ b/deps/com.github.aiortc.aiortc @@ -1 +1 @@ -Subproject commit 857be4a1fb1c07e2a239b61ce49b34cdd1698467 +Subproject commit e6422d353cda8ff688ceff7036b91d2a0de0d277 diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index e4c6ccd..d091763 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -65,6 +65,46 @@ class CLI(abc.ABC): argv, ) + def pip_sync( + self, + project: str, + features: list[str], + ) -> None: + from . import cli_bootstrap + + pyproject = cli_bootstrap.pyproject_load( + self.projects[project].source_dir / 'pyproject.toml' + ) + + dependencies = sum([ + pyproject.dependencies[o] + for o in features + ], []) + + pip_find_links : list[pathlib.Path] = [] + + if not pyproject.pip_find_links is None: + pip_find_links.extend(pyproject.pip_find_links) + + + logger.info(dict( + dependencies=dependencies, + )) + + if len(dependencies) > 0: + subprocess.check_call([ + self.dist_settings.python_path, + '-m', + 'uv', 'pip', 'install', + *sum([ + ['-f', str(o),] + for o in pip_find_links + ], []), + # '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'), + '--offline', + *dependencies, + ]) + def deploy_fetch_dist( self, force: bool, @@ -138,6 +178,16 @@ class CLI(abc.ABC): latest_file['path'], ]) + @property + def pkg_config_path(self,) -> set[pathlib.Path]: + return { + pathlib.Path(o) + for o in glob.glob( + str(self.dist_settings.env_path / 'lib' / 'python*' / '**' / 'pkgconfig'), + recursive=True, + ) + } + def deploy_wheel( self, project_name: str, @@ -170,11 +220,22 @@ class CLI(abc.ABC): if env is None: env = dict() + extra_args: list[str] = [] + + if len(self.third_party_roots) > 0: + extra_args.extend([ + '-Csetup-args=%s' % ( + '-Dthird_party_roots=%s' % str(o.absolute()) + ) + for o in self.third_party_roots + ]) + cmd = [ sys.executable, '-m', 'build', '-w', '-n', + *extra_args, '-Csetup-args=-Dmodes=pyproject', '-Cbuild-dir=%s' % str(project.build_dir / 'pyproject'), '-Csetup-args=-Dinstall_path=%s' % str(project.dest_dir), @@ -269,11 +330,16 @@ class CLI(abc.ABC): *argv, ]) + @property + def third_party_roots(self) -> list[pathlib.Path]: + return [] + def meson_setup( self, project_name: str, force: bool, argv: Optional[list[str]] = None, + # third_party_roots: Optional[list[pathlib.Path]] = None, ) -> None: project = self.projects[project_name] @@ -285,12 +351,21 @@ class CLI(abc.ABC): logger.info(dict(action='removing build dir', path=project.build_dir / 'meson')) shutil.rmtree(project.build_dir / 'meson') + extra_args : list[str] = [] + + if len(self.third_party_roots) > 0: + extra_args.extend([ + '-Dthird_party_roots=%s' % str(o.absolute()) + for o in self.third_party_roots + ]) + cmd = [ shutil_which('meson', True,), 'setup', str(project.source_dir), str(project.build_dir / 'meson'), '-Dmodes=["meson"]', + *extra_args, # '-Dpkgconfig.relocatable=true', '-Dprefix=/', *argv, diff --git a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py index 026cbba..10d0381 100644 --- a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py +++ b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py @@ -17,6 +17,7 @@ logger = logging.getLogger(__name__) class PyProject: dependencies: dict[str, list[str]] early_features: Optional[list[str]] = None + pip_find_links: Optional[list[pathlib.Path]] = None def pyproject_load( d: pathlib.Path, @@ -42,7 +43,7 @@ def pyproject_load( assert isinstance(v, list) assert isinstance(k, str) - dependencies[k] = v + dependencies[k] = v res = PyProject( @@ -65,6 +66,12 @@ def pyproject_load( if 'early_features' in content['tool'][tool_name]: res.early_features = content['tool'][tool_name]['early_features'] + if 'pip_find_links' in content['tool'][tool_name]: + res.pip_find_links = [ + pathlib.Path(o) + for o in content['tool'][tool_name]['pip_find_links'] + ] + return res @dataclasses.dataclass @@ -115,20 +122,25 @@ def env_bootstrap( 'build', 'setuptools', 'meson-python', 'pybind11', ]) - early_wheels = glob.glob( - str( - pathlib.Path(__file__).parent / 'deps' / 'dist' / 'early' / '*.whl' - ) - ) + # early_wheels = glob.glob( + # str( + # pathlib.Path(__file__).parent / 'deps' / 'dist' / 'early' / '*.whl' + # ) + # ) - if len(early_wheels) > 0: - subprocess.check_call([ - bootstrap_settings.python_path, - '-m', - 'uv', 'pip', 'install', - '--offline', - *early_wheels, - ]) + # if len(early_wheels) > 0: + # subprocess.check_call([ + # bootstrap_settings.python_path, + # '-m', + # 'uv', 'pip', 'install', + # '--offline', + # *early_wheels, + # ]) + + pip_find_links : list[pathlib.Path] = [] + + if not pyproject.pip_find_links is None: + pip_find_links.extend(pyproject.pip_find_links) if pyproject.early_features: early_dependencies = sum([ @@ -139,11 +151,17 @@ def env_bootstrap( logger.info(dict( early_dependencies=early_dependencies, )) + if len(early_dependencies) > 0: subprocess.check_call([ bootstrap_settings.python_path, '-m', 'uv', 'pip', 'install', + *sum([ + ['-f', str(o),] + for o in pip_find_links + ], []), + # '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'), '--offline', *early_dependencies, ]) diff --git a/python/online/fxreader/pr34/commands_typed/pip.py b/python/online/fxreader/pr34/commands_typed/pip.py new file mode 100644 index 0000000..2af5e32 --- /dev/null +++ b/python/online/fxreader/pr34/commands_typed/pip.py @@ -0,0 +1,10 @@ +import pip._internal.commands.show + +def pip_show( + argv: list[str], +) -> list[pip._internal.commands.show._PackageInfo]: + return list( + pip._internal.commands.show.search_packages_info( + argv, + ) + ) \ No newline at end of file diff --git a/python/pyproject.toml b/python/pyproject.toml index bc3c56a..6663472 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = 'online.fxreader.pr34' -version = '0.1.1' +version = '0.1.4' dependencies = [ #"-r requirements.txt",