Compare commits
	
		
			5 Commits
		
	
	
		
			0cee9beaea
			...
			7d1d887692
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7d1d887692 | |||
| 212c8c8086 | |||
| 6599115a68 | |||
| 22f5f0fba3 | |||
| c9382162de | 
							
								
								
									
										2
									
								
								deps/com.github.aiortc.aiortc
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								deps/com.github.aiortc.aiortc
									
									
									
									
										vendored
									
									
								
							| @ -1 +1 @@ | |||||||
| Subproject commit 857be4a1fb1c07e2a239b61ce49b34cdd1698467 | Subproject commit f94ded8fbfe62bea6e96827312eb25853990ecd3 | ||||||
| @ -133,5 +133,24 @@ | |||||||
|         "key": "ctrl+b", |         "key": "ctrl+b", | ||||||
|         "command": "-extension.vim_ctrl+b", |         "command": "-extension.vim_ctrl+b", | ||||||
|         "when": "editorTextFocus && vim.active && vim.use<C-b> && !inDebugRepl && vim.mode != 'Insert'" |         "when": "editorTextFocus && vim.active && vim.use<C-b> && !inDebugRepl && vim.mode != 'Insert'" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "key": "ctrl+w", | ||||||
|  |         "command": "-workbench.action.closeActiveEditor" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "key": "ctrl+w", | ||||||
|  |         "command": "-workbench.action.closeGroup", | ||||||
|  |         "when": "activeEditorGroupEmpty && multipleEditorGroups" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "key": "ctrl+w", | ||||||
|  |         "command": "-extension.vim_ctrl+w", | ||||||
|  |         "when": "editorTextFocus && vim.active && vim.use<C-w> && !inDebugRepl" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "key": "ctrl+w", | ||||||
|  |         "command": "workbench.action.closeActiveEditor", | ||||||
|  |         "when": "editorTextFocus" | ||||||
|     } |     } | ||||||
| ] | ] | ||||||
| @ -47,5 +47,42 @@ | |||||||
|     "workbench.preferredHighContrastColorTheme": "Monokai", |     "workbench.preferredHighContrastColorTheme": "Monokai", | ||||||
|     "workbench.preferredHighContrastLightColorTheme": "Monokai", |     "workbench.preferredHighContrastLightColorTheme": "Monokai", | ||||||
|     "workbench.preferredLightColorTheme": "Monokai", |     "workbench.preferredLightColorTheme": "Monokai", | ||||||
|     "mesonbuild.downloadLanguageServer": false |     "mesonbuild.downloadLanguageServer": false, | ||||||
|  |     // "vim.easymotion": true, | ||||||
|  |     // "vim.incsearch": true, | ||||||
|  |     "vim.useSystemClipboard": true, | ||||||
|  |     // "vim.useCtrlKeys": true, | ||||||
|  |     "vim.hlsearch": true, | ||||||
|  |     // "vim.insertModeKeyBindings": [ | ||||||
|  |     //     { | ||||||
|  |     //     "before": ["j", "j"], | ||||||
|  |     //     "after": ["<Esc>"] | ||||||
|  |     //     } | ||||||
|  |     // ], | ||||||
|  |     "vim.normalModeKeyBindingsNonRecursive": [ | ||||||
|  |         { | ||||||
|  |             "before": ["<leader>", "w"], | ||||||
|  |             "after": ["<C-w>"], | ||||||
|  |             // "after": ["d", "d"] | ||||||
|  |         }, | ||||||
|  |         // { | ||||||
|  |         //     "before": ["<C-n>"], | ||||||
|  |         //     "commands": [":nohl"] | ||||||
|  |         // }, | ||||||
|  |         // { | ||||||
|  |         //     "before": ["K"], | ||||||
|  |         //     "commands": ["lineBreakInsert"], | ||||||
|  |         //     "silent": true | ||||||
|  |         // } | ||||||
|  |     ], | ||||||
|  |     "vim.leader": "\\", | ||||||
|  |     // "vim.handleKeys": { | ||||||
|  |     //     "<C-a>": false, | ||||||
|  |     //     "<C-f>": false | ||||||
|  |     // }, | ||||||
|  | 
 | ||||||
|  |     "// To improve performance", | ||||||
|  |     "extensions.experimental.affinity": { | ||||||
|  |         "vscodevim.vim": 1 | ||||||
|  |     }, | ||||||
| } | } | ||||||
| @ -65,6 +65,46 @@ class CLI(abc.ABC): | |||||||
|             argv, |             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( |     def deploy_fetch_dist( | ||||||
|         self, |         self, | ||||||
|         force: bool, |         force: bool, | ||||||
| @ -138,6 +178,16 @@ class CLI(abc.ABC): | |||||||
|                         latest_file['path'], |                         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( |     def deploy_wheel( | ||||||
|         self, |         self, | ||||||
|         project_name: str, |         project_name: str, | ||||||
| @ -156,7 +206,10 @@ class CLI(abc.ABC): | |||||||
|         #     Command.meson_setup.value, |         #     Command.meson_setup.value, | ||||||
|         # ]) |         # ]) | ||||||
| 
 | 
 | ||||||
|         assert argv is None or len(argv) == 0 |         if argv is None: | ||||||
|  |             argv = [] | ||||||
|  | 
 | ||||||
|  |         # assert argv is None or len(argv) == 0 | ||||||
| 
 | 
 | ||||||
|         if not project.meson_path is None: |         if not project.meson_path is None: | ||||||
|             self.meson_install( |             self.meson_install( | ||||||
| @ -170,16 +223,28 @@ class CLI(abc.ABC): | |||||||
|         if env is None: |         if env is None: | ||||||
|             env = dict() |             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 = [ |         cmd = [ | ||||||
|             sys.executable, |             sys.executable, | ||||||
|             '-m', |             '-m', | ||||||
|             'build', |             'build', | ||||||
|             '-w', '-n', |             '-w', '-n', | ||||||
|  |             *extra_args, | ||||||
|             '-Csetup-args=-Dmodes=pyproject', |             '-Csetup-args=-Dmodes=pyproject', | ||||||
|             '-Cbuild-dir=%s' % str(project.build_dir / 'pyproject'), |             '-Cbuild-dir=%s' % str(project.build_dir / 'pyproject'), | ||||||
|             '-Csetup-args=-Dinstall_path=%s' % str(project.dest_dir), |             '-Csetup-args=-Dinstall_path=%s' % str(project.dest_dir), | ||||||
|             # '-Cbuild-dir=%s' % str(project.build_dir), |             # '-Cbuild-dir=%s' % str(project.build_dir), | ||||||
|             str(project.source_dir), |             str(project.source_dir), | ||||||
|  |             *argv, | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|         if not output_dir is None: |         if not output_dir is None: | ||||||
| @ -269,11 +334,16 @@ class CLI(abc.ABC): | |||||||
|             *argv, |             *argv, | ||||||
|         ]) |         ]) | ||||||
| 
 | 
 | ||||||
|  |     @property | ||||||
|  |     def third_party_roots(self) -> list[pathlib.Path]: | ||||||
|  |         return [] | ||||||
|  | 
 | ||||||
|     def meson_setup( |     def meson_setup( | ||||||
|         self, |         self, | ||||||
|         project_name: str, |         project_name: str, | ||||||
|         force: bool, |         force: bool, | ||||||
|         argv: Optional[list[str]] = None, |         argv: Optional[list[str]] = None, | ||||||
|  |         # third_party_roots: Optional[list[pathlib.Path]] = None, | ||||||
|     ) -> None: |     ) -> None: | ||||||
|         project = self.projects[project_name] |         project = self.projects[project_name] | ||||||
| 
 | 
 | ||||||
| @ -285,12 +355,21 @@ class CLI(abc.ABC): | |||||||
|                 logger.info(dict(action='removing build dir', path=project.build_dir / 'meson')) |                 logger.info(dict(action='removing build dir', path=project.build_dir / 'meson')) | ||||||
|                 shutil.rmtree(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 = [ |         cmd = [ | ||||||
|             shutil_which('meson', True,), |             shutil_which('meson', True,), | ||||||
|             'setup', |             'setup', | ||||||
|             str(project.source_dir), |             str(project.source_dir), | ||||||
|             str(project.build_dir / 'meson'), |             str(project.build_dir / 'meson'), | ||||||
|             '-Dmodes=["meson"]', |             '-Dmodes=["meson"]', | ||||||
|  |             *extra_args, | ||||||
|             # '-Dpkgconfig.relocatable=true', |             # '-Dpkgconfig.relocatable=true', | ||||||
|             '-Dprefix=/', |             '-Dprefix=/', | ||||||
|             *argv, |             *argv, | ||||||
|  | |||||||
| @ -17,6 +17,9 @@ logger = logging.getLogger(__name__) | |||||||
| class PyProject: | class PyProject: | ||||||
|     dependencies: dict[str, list[str]] |     dependencies: dict[str, list[str]] | ||||||
|     early_features: Optional[list[str]] = None |     early_features: Optional[list[str]] = None | ||||||
|  |     pip_find_links: Optional[list[pathlib.Path]] = None | ||||||
|  |     runtime_libdirs: Optional[list[pathlib.Path]] = None | ||||||
|  |     runtime_preload: Optional[list[pathlib.Path]] = None | ||||||
|      |      | ||||||
| def pyproject_load( | def pyproject_load( | ||||||
|     d: pathlib.Path, |     d: pathlib.Path, | ||||||
| @ -42,7 +45,7 @@ def pyproject_load( | |||||||
|             assert isinstance(v, list) |             assert isinstance(v, list) | ||||||
|             assert isinstance(k, str) |             assert isinstance(k, str) | ||||||
| 
 | 
 | ||||||
|         dependencies[k] = v |             dependencies[k] = v | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     res = PyProject( |     res = PyProject( | ||||||
| @ -65,6 +68,26 @@ def pyproject_load( | |||||||
|         if 'early_features' in content['tool'][tool_name]: |         if 'early_features' in content['tool'][tool_name]: | ||||||
|             res.early_features = content['tool'][tool_name]['early_features'] |             res.early_features = content['tool'][tool_name]['early_features'] | ||||||
| 
 | 
 | ||||||
|  |         if 'pip_find_links' in content['tool'][tool_name]: | ||||||
|  |             res.pip_find_links = [ | ||||||
|  |                 d.parent / pathlib.Path(o) | ||||||
|  |                 for o in content['tool'][tool_name]['pip_find_links'] | ||||||
|  |             ] | ||||||
|  | 
 | ||||||
|  |         if 'runtime_libdirs' in content['tool'][tool_name]: | ||||||
|  |             res.runtime_libdirs = [ | ||||||
|  |                 d.parent / pathlib.Path(o) | ||||||
|  |                 # pathlib.Path(o) | ||||||
|  |                 for o in content['tool'][tool_name]['runtime_libdirs'] | ||||||
|  |             ] | ||||||
|  | 
 | ||||||
|  |         if 'runtime_preload' in content['tool'][tool_name]: | ||||||
|  |             res.runtime_preload = [ | ||||||
|  |                 d.parent / pathlib.Path(o) | ||||||
|  |                 # pathlib.Path(o) | ||||||
|  |                 for o in content['tool'][tool_name]['runtime_preload'] | ||||||
|  |             ] | ||||||
|  | 
 | ||||||
|     return res |     return res | ||||||
| 
 | 
 | ||||||
| @dataclasses.dataclass | @dataclasses.dataclass | ||||||
| @ -115,20 +138,25 @@ def env_bootstrap( | |||||||
|         'build', 'setuptools', 'meson-python', 'pybind11', |         'build', 'setuptools', 'meson-python', 'pybind11', | ||||||
|     ]) |     ]) | ||||||
| 
 | 
 | ||||||
|     early_wheels = glob.glob( |     # early_wheels = glob.glob( | ||||||
|         str( |     #     str( | ||||||
|             pathlib.Path(__file__).parent / 'deps' / 'dist' / 'early' / '*.whl' |     #         pathlib.Path(__file__).parent / 'deps' / 'dist' / 'early' / '*.whl' | ||||||
|         ) |     #     ) | ||||||
|     ) |     # ) | ||||||
| 
 | 
 | ||||||
|     if len(early_wheels) > 0: |     # if len(early_wheels) > 0: | ||||||
|         subprocess.check_call([ |     #     subprocess.check_call([ | ||||||
|             bootstrap_settings.python_path, |     #         bootstrap_settings.python_path, | ||||||
|             '-m', |     #         '-m', | ||||||
|             'uv', 'pip', 'install', |     #         'uv', 'pip', 'install', | ||||||
|             '--offline', |     #         '--offline', | ||||||
|             *early_wheels, |     #         *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: |     if pyproject.early_features: | ||||||
|         early_dependencies = sum([ |         early_dependencies = sum([ | ||||||
| @ -139,11 +167,17 @@ def env_bootstrap( | |||||||
|         logger.info(dict( |         logger.info(dict( | ||||||
|             early_dependencies=early_dependencies, |             early_dependencies=early_dependencies, | ||||||
|         )) |         )) | ||||||
|  | 
 | ||||||
|         if len(early_dependencies) > 0: |         if len(early_dependencies) > 0: | ||||||
|             subprocess.check_call([ |             subprocess.check_call([ | ||||||
|                 bootstrap_settings.python_path, |                 bootstrap_settings.python_path, | ||||||
|                 '-m', |                 '-m', | ||||||
|                 'uv', 'pip', 'install', |                 'uv', 'pip', 'install', | ||||||
|  |                 *sum([ | ||||||
|  |                     ['-f', str(o),] | ||||||
|  |                     for o in pip_find_links | ||||||
|  |                 ], []), | ||||||
|  |                 # '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'), | ||||||
|                 '--offline', |                 '--offline', | ||||||
|                 *early_dependencies, |                 *early_dependencies, | ||||||
|             ]) |             ]) | ||||||
|  | |||||||
| @ -1,7 +1,17 @@ | |||||||
| import shutil | import shutil | ||||||
|  | import glob | ||||||
|  | import pathlib | ||||||
|  | import ctypes | ||||||
|  | import os | ||||||
|  | import sys | ||||||
|  | import logging | ||||||
|  | 
 | ||||||
|  | logger = logging.getLogger(__name__) | ||||||
| 
 | 
 | ||||||
| from typing import (overload, Optional, Literal,) | from typing import (overload, Optional, Literal,) | ||||||
| 
 | 
 | ||||||
|  | from .cli_bootstrap import PyProject | ||||||
|  | 
 | ||||||
| @overload | @overload | ||||||
| def shutil_which( | def shutil_which( | ||||||
|     name: str, |     name: str, | ||||||
| @ -22,4 +32,61 @@ def shutil_which( | |||||||
|     if res is None and raise_on_failure: |     if res is None and raise_on_failure: | ||||||
|         raise NotImplementedError |         raise NotImplementedError | ||||||
|     else: |     else: | ||||||
|         return res |         return res | ||||||
|  | 
 | ||||||
|  | def runtime_libdirs_init( | ||||||
|  |     project: PyProject, | ||||||
|  | ) -> None: | ||||||
|  |     if sys.platform == 'linux': | ||||||
|  |         ld_library_path : list[pathlib.Path] = [ | ||||||
|  |             o | ||||||
|  |             for o in [ | ||||||
|  |                 *[ | ||||||
|  |                     o.absolute() | ||||||
|  |                     for o in ( | ||||||
|  |                         project.runtime_libdirs | ||||||
|  |                         if project.runtime_libdirs | ||||||
|  |                         else [] | ||||||
|  |                     ) | ||||||
|  |                 ], | ||||||
|  |                 *[ | ||||||
|  |                     pathlib.Path(o) | ||||||
|  |                     for o in os.environ.get( | ||||||
|  |                         'LD_LIBRARY_PATH', | ||||||
|  |                         '' | ||||||
|  |                     ).split(os.path.pathsep) | ||||||
|  |                     if o != '' | ||||||
|  |                 ] | ||||||
|  |             ] | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         ld_library_path_present : list[pathlib.Path] = [] | ||||||
|  | 
 | ||||||
|  |         for o in ld_library_path: | ||||||
|  |             if not o.exists(): | ||||||
|  |                 logger.warning(dict( | ||||||
|  |                     ld_library_path=o, | ||||||
|  |                     msg='not found', | ||||||
|  |                 )) | ||||||
|  | 
 | ||||||
|  |             ld_library_path_present.append(o) | ||||||
|  | 
 | ||||||
|  |         os.environ.update( | ||||||
|  |             LD_LIBRARY_PATH=os.path.pathsep.join([ | ||||||
|  |                 str(o) for o in ld_library_path_present | ||||||
|  |             ]) | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |         for preload_path in (project.runtime_preload or []): | ||||||
|  |             for preload_found in glob.glob(str( | ||||||
|  |                 preload_path.parent / ('lib%s.so' % preload_path.name) | ||||||
|  |             )): | ||||||
|  |                 logger.info(dict( | ||||||
|  |                     preload_path=preload_path, preload_found=preload_found, | ||||||
|  |                     # lib_path=o, | ||||||
|  |                     msg='load_library', | ||||||
|  |                 )) | ||||||
|  | 
 | ||||||
|  |                 ctypes.cdll.LoadLibrary(preload_found) | ||||||
|  |     else: | ||||||
|  |         raise NotImplementedError | ||||||
							
								
								
									
										10
									
								
								python/online/fxreader/pr34/commands_typed/pip.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										10
									
								
								python/online/fxreader/pr34/commands_typed/pip.py
									
									
									
									
									
										Normal file
									
								
							| @ -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, | ||||||
|  |         ) | ||||||
|  |     ) | ||||||
| @ -1,6 +1,6 @@ | |||||||
| [project] | [project] | ||||||
| name = 'online.fxreader.pr34' | name = 'online.fxreader.pr34' | ||||||
| version = '0.1.1' | version = '0.1.4.8' | ||||||
| 
 | 
 | ||||||
| dependencies = [ | dependencies = [ | ||||||
|     #"-r requirements.txt", |     #"-r requirements.txt", | ||||||
| @ -38,8 +38,8 @@ include-package-data = false | |||||||
| #exclude = ['*'] | #exclude = ['*'] | ||||||
| #include = ['*.py'] | #include = ['*.py'] | ||||||
| 
 | 
 | ||||||
| [tool.setuptools.exclude-package-data] | # [tool.setuptools.exclude-package-data] | ||||||
| 'online.fxreader.pr34' = ['online/fxreader/pr34/py.typed'] | # 'online.fxreader.pr34' = ['online/fxreader/pr34/py.typed'] | ||||||
| 
 | 
 | ||||||
| #[tool.setuptools.package-data] | #[tool.setuptools.package-data] | ||||||
| #'online_fxreader.vpn' = ['requirements.txt'] | #'online_fxreader.vpn' = ['requirements.txt'] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user