Compare commits
7 Commits
ebbd1a2b5b
...
905241a068
Author | SHA1 | Date | |
---|---|---|---|
905241a068 | |||
01aab0517a | |||
6ddfc7d2d7 | |||
3245d6d7e5 | |||
a529db106a | |||
57f74df865 | |||
528d9b1ce5 |
1
Makefile
1
Makefile
@ -74,5 +74,6 @@ dotfiles_put:
|
||||
#commands install -f -p dotfiles -s dotfiles/ -t ~/.config/
|
||||
|
||||
dotfiles_fetch:
|
||||
commands install -f -p ~ -s ~/.config/katerc -t dotfiles
|
||||
commands install -f -p ~ -s ~/.config/Code\ -\ OSS/User/keybindings.json -t dotfiles
|
||||
commands install -f -p ~ -s ~/.config/Code\ -\ OSS/User/settings.json -t dotfiles
|
||||
|
2
deps/com.github.aiortc.aiortc
vendored
2
deps/com.github.aiortc.aiortc
vendored
@ -1 +1 @@
|
||||
Subproject commit e27d400c07ddbe66e1ef73da1a5754c28cfec157
|
||||
Subproject commit 352e3f68754ab93eb8449ee0751b40991f5a6b73
|
@ -3,7 +3,6 @@
|
||||
"editor.minimap.autohide": true,
|
||||
"editor.minimap.maxColumn": 80,
|
||||
"editor.minimap.size": "fit",
|
||||
"diffEditor.hideUnchangedRegions.enabled": true,
|
||||
"python.experiments.enabled": false,
|
||||
"debugpy.debugJustMyCode": false,
|
||||
"python.REPL.enableREPLSmartSend": false,
|
||||
@ -13,7 +12,7 @@
|
||||
"typescript.surveys.enabled": false,
|
||||
"typescript.suggestionActions.enabled": false,
|
||||
"typescript.tsserver.enableRegionDiagnostics": false,
|
||||
"typescript.tsserver.maxTsServerMemory": 5,
|
||||
"typescript.tsserver.maxTsServerMemory": 0.05,
|
||||
"typescript.tsserver.useSyntaxServer": "never",
|
||||
"typescript.tsserver.web.typeAcquisition.enabled": false,
|
||||
"typescript.validate.enable": false,
|
||||
@ -80,9 +79,73 @@
|
||||
// "<C-a>": false,
|
||||
// "<C-f>": false
|
||||
// },
|
||||
|
||||
"// To improve performance",
|
||||
"extensions.experimental.affinity": {
|
||||
"vscodevim.vim": 1
|
||||
},
|
||||
"diffEditor.experimental.showMoves": true,
|
||||
"diffEditor.hideUnchangedRegions.enabled": true,
|
||||
"python.locator": "native",
|
||||
"python.testing.promptToConfigure": false,
|
||||
"typescript.format.enable": false,
|
||||
"typescript.format.indentSwitchCase": false,
|
||||
"typescript.preferences.renameMatchingJsxTags": false,
|
||||
"typescript.autoClosingTags": false,
|
||||
"typescript.format.insertSpaceAfterCommaDelimiter": false,
|
||||
"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
|
||||
"docker.enableDockerComposeLanguageService": false,
|
||||
"go.useLanguageServer": false,
|
||||
"search.maxResults": 128,
|
||||
"search.ripgrep.maxThreads": 1,
|
||||
"search.searchEditor.defaultNumberOfContextLines": 7,
|
||||
"search.searchOnType": false,
|
||||
"task.allowAutomaticTasks": "off",
|
||||
"task.autoDetect": "off",
|
||||
"task.quickOpen.detail": false,
|
||||
"task.reconnection": false,
|
||||
"javascript.autoClosingTags": false,
|
||||
"javascript.format.enable": false,
|
||||
"javascript.format.insertSpaceAfterCommaDelimiter": false,
|
||||
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
|
||||
"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
|
||||
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
|
||||
"javascript.format.insertSpaceAfterSemicolonInForStatements": false,
|
||||
"javascript.format.insertSpaceBeforeAndAfterBinaryOperators": false,
|
||||
"javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName": false,
|
||||
"javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName": false,
|
||||
"javascript.preferences.renameMatchingJsxTags": false,
|
||||
"javascript.preferences.useAliasesForRenames": false,
|
||||
"javascript.suggest.autoImports": false,
|
||||
"javascript.suggest.classMemberSnippets.enabled": false,
|
||||
"javascript.suggest.completeJSDocs": false,
|
||||
"javascript.suggest.enabled": false,
|
||||
"javascript.suggest.includeAutomaticOptionalChainCompletions": false,
|
||||
"javascript.suggest.includeCompletionsForImportStatements": false,
|
||||
"javascript.suggest.jsdoc.generateReturns": false,
|
||||
"javascript.suggest.names": false,
|
||||
"javascript.suggest.paths": false,
|
||||
"javascript.suggestionActions.enabled": false,
|
||||
"javascript.updateImportsOnFileMove.enabled": "never",
|
||||
"javascript.validate.enable": false,
|
||||
"js/ts.implicitProjectConfig.strictFunctionTypes": false,
|
||||
"js/ts.implicitProjectConfig.strictNullChecks": false,
|
||||
"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
|
||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
|
||||
"typescript.format.insertSpaceAfterSemicolonInForStatements": false,
|
||||
"typescript.format.insertSpaceBeforeAndAfterBinaryOperators": false,
|
||||
"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName": false,
|
||||
"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName": false,
|
||||
"typescript.preferences.useAliasesForRenames": false,
|
||||
"typescript.reportStyleChecksAsWarnings": false,
|
||||
"typescript.suggest.autoImports": false,
|
||||
"typescript.suggest.classMemberSnippets.enabled": false,
|
||||
"typescript.suggest.completeJSDocs": false,
|
||||
"typescript.suggest.enabled": false,
|
||||
"typescript.suggest.includeAutomaticOptionalChainCompletions": false,
|
||||
"typescript.suggest.includeCompletionsForImportStatements": false,
|
||||
"typescript.suggest.jsdoc.generateReturns": false,
|
||||
"typescript.suggest.objectLiteralMethodSnippets.enabled": false,
|
||||
"typescript.suggest.paths": false,
|
||||
"typescript.tsc.autoDetect": "off",
|
||||
}
|
261
dotfiles/.config/katerc
Normal file
261
dotfiles/.config/katerc
Normal file
@ -0,0 +1,261 @@
|
||||
[BuildConfig]
|
||||
AllowedCommandLines=
|
||||
AutoSwitchToOutput=true
|
||||
BlockedCommandLines=
|
||||
UseDiagnosticsOutput=true
|
||||
|
||||
[CTags]
|
||||
GlobalCommand=ctags -R --c++-types=+px --extra=+q --excmd=pattern --exclude=Makefile --exclude=.
|
||||
GlobalNumTargets=0
|
||||
|
||||
[General]
|
||||
Allow Tab Scrolling=true
|
||||
Auto Hide Tabs=false
|
||||
Close After Last=false
|
||||
Close documents with window=true
|
||||
Cycle To First Tab=true
|
||||
Days Meta Infos=30
|
||||
Diagnostics Limit=12000
|
||||
Diff Show Style=0
|
||||
Elide Tab Text=false
|
||||
Enable Context ToolView=false
|
||||
Expand Tabs=false
|
||||
Icon size for left and right sidebar buttons=32
|
||||
Last Session=calibre
|
||||
Modified Notification=false
|
||||
Mouse back button action=0
|
||||
Mouse forward button action=0
|
||||
Open New Tab To The Right Of Current=true
|
||||
Output History Limit=100
|
||||
Output With Date=false
|
||||
Quickopen Filter Mode=0
|
||||
Quickopen List Mode=true
|
||||
Recent File List Entry Count=10
|
||||
Restore Window Configuration=true
|
||||
SDI Mode=false
|
||||
Save Meta Infos=false
|
||||
Session Manager Sort Column=0
|
||||
Session Manager Sort Order=0
|
||||
Show Full Path in Title=true
|
||||
Show Menu Bar=true
|
||||
Show Status Bar=false
|
||||
Show Symbol In Navigation Bar=true
|
||||
Show Tab Bar=true
|
||||
Show Tabs Close Button=true
|
||||
Show Url Nav Bar=false
|
||||
Show output view for message type=1
|
||||
Show text for left and right sidebar=false
|
||||
Show welcome view for new window=true
|
||||
Startup Session=manual
|
||||
Stash new unsaved files=true
|
||||
Stash unsaved file changes=false
|
||||
Sync section size with tab positions=false
|
||||
Tab Double Click New Document=true
|
||||
Tab Middle Click Close Document=true
|
||||
Tabbar Tab Limit=0
|
||||
|
||||
[KDE]
|
||||
widgetStyle=Fusion
|
||||
|
||||
[KTextEditor Document]
|
||||
Allow End of Line Detection=true
|
||||
Auto Detect Indent=true
|
||||
Auto Reload If State Is In Version Control=true
|
||||
Auto Save=false
|
||||
Auto Save Interval=0
|
||||
Auto Save On Focus Out=false
|
||||
BOM=false
|
||||
Backup Local=false
|
||||
Backup Prefix=
|
||||
Backup Remote=false
|
||||
Backup Suffix=~
|
||||
Camel Cursor=true
|
||||
Encoding=UTF-8
|
||||
End of Line=0
|
||||
Indent On Backspace=true
|
||||
Indent On Tab=true
|
||||
Indent On Text Paste=true
|
||||
Indentation Mode=normal
|
||||
Indentation Width=4
|
||||
Keep Extra Spaces=false
|
||||
Line Length Limit=10000
|
||||
Newline at End of File=true
|
||||
On-The-Fly Spellcheck=false
|
||||
Overwrite Mode=false
|
||||
PageUp/PageDown Moves Cursor=false
|
||||
Remove Spaces=1
|
||||
ReplaceTabsDyn=true
|
||||
Show Spaces=2
|
||||
Show Tabs=true
|
||||
Smart Home=true
|
||||
Swap Directory=
|
||||
Swap File Mode=1
|
||||
Swap Sync Interval=15
|
||||
Tab Handling=2
|
||||
Tab Width=4
|
||||
Trailing Marker Size=1
|
||||
Use Editor Config=true
|
||||
Word Wrap=false
|
||||
Word Wrap Column=80
|
||||
|
||||
[KTextEditor Renderer]
|
||||
Animate Bracket Matching=false
|
||||
Auto Color Theme Selection=false
|
||||
Color Theme=Monokai
|
||||
Line Height Multiplier=1
|
||||
Show Indentation Lines=false
|
||||
Show Whole Bracket Expression=false
|
||||
Text Font=Terminus,11,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
|
||||
Text Font Features=
|
||||
Word Wrap Marker=false
|
||||
|
||||
[KTextEditor View]
|
||||
Allow Mark Menu=true
|
||||
Auto Brackets=true
|
||||
Auto Center Lines=0
|
||||
Auto Completion=true
|
||||
Auto Completion Preselect First Entry=true
|
||||
Backspace Remove Composed Characters=false
|
||||
Bookmark Menu Sorting=0
|
||||
Bracket Match Preview=true
|
||||
Chars To Enclose Selection=<>(){}[]'"
|
||||
Default Mark Type=1
|
||||
Dynamic Word Wrap=true
|
||||
Dynamic Word Wrap Align Indent=80
|
||||
Dynamic Word Wrap At Static Marker=false
|
||||
Dynamic Word Wrap Indicators=1
|
||||
Dynamic Wrap not at word boundaries=false
|
||||
Enable Accessibility=true
|
||||
Enable Tab completion=false
|
||||
Enter To Insert Completion=true
|
||||
Fold First Line=false
|
||||
Folding Bar=true
|
||||
Folding Preview=true
|
||||
Icon Bar=false
|
||||
Input Mode=1
|
||||
Keyword Completion=true
|
||||
Line Modification=true
|
||||
Line Numbers=true
|
||||
Max Clipboard History Entries=20
|
||||
Maximum Search History Size=100
|
||||
Mouse Paste At Cursor Position=false
|
||||
Multiple Cursor Modifier=134217728
|
||||
Persistent Selection=false
|
||||
Scroll Bar Marks=false
|
||||
Scroll Bar Mini Map All=true
|
||||
Scroll Bar Mini Map Width=60
|
||||
Scroll Bar MiniMap=false
|
||||
Scroll Bar Preview=true
|
||||
Scroll Past End=false
|
||||
Search/Replace Flags=140
|
||||
Shoe Line Ending Type in Statusbar=false
|
||||
Show Documentation With Completion=true
|
||||
Show File Encoding=true
|
||||
Show Folding Icons On Hover Only=true
|
||||
Show Line Count=true
|
||||
Show Scrollbars=0
|
||||
Show Statusbar Dictionary=true
|
||||
Show Statusbar Highlighting Mode=true
|
||||
Show Statusbar Input Mode=true
|
||||
Show Statusbar Line Column=true
|
||||
Show Statusbar Tab Settings=true
|
||||
Show Word Count=true
|
||||
Smart Copy Cut=true
|
||||
Statusbar Line Column Compact Mode=true
|
||||
Text Drag And Drop=true
|
||||
User Sets Of Chars To Enclose Selection=
|
||||
Vi Input Mode Steal Keys=false
|
||||
Vi Relative Line Numbers=false
|
||||
Word Completion=true
|
||||
Word Completion Minimal Word Length=3
|
||||
Word Completion Remove Tail=true
|
||||
|
||||
[Konsole]
|
||||
AutoSyncronizeMode=0
|
||||
KonsoleEscKeyBehaviour=false
|
||||
KonsoleEscKeyExceptions=vi,vim,nvim,git
|
||||
RemoveExtension=false
|
||||
RunPrefix=
|
||||
SetEditor=false
|
||||
|
||||
[MainWindow]
|
||||
1366x768 screen: Window-Maximized=true
|
||||
ToolBarsMovable=Disabled
|
||||
|
||||
[Printing][HeaderFooter]
|
||||
FooterBackground=211,211,211
|
||||
FooterBackgroundEnabled=false
|
||||
FooterEnabled=true
|
||||
FooterForeground=0,0,0
|
||||
FooterFormatCenter=
|
||||
FooterFormatLeft=
|
||||
FooterFormatRight=%U
|
||||
HeaderBackground=211,211,211
|
||||
HeaderBackgroundEnabled=false
|
||||
HeaderEnabled=true
|
||||
HeaderFooterFont=monospace,10,-1,5,400,0,0,0,1,0,0,0,0,0,0,1
|
||||
HeaderForeground=0,0,0
|
||||
HeaderFormatCenter=%f
|
||||
HeaderFormatLeft=%y
|
||||
HeaderFormatRight=%p
|
||||
|
||||
[Printing][Layout]
|
||||
BackgroundColorEnabled=false
|
||||
BoxColor=invalid
|
||||
BoxEnabled=false
|
||||
BoxMargin=6
|
||||
BoxWidth=1
|
||||
ColorScheme=Printing
|
||||
Font=monospace,10,-1,5,400,0,0,0,1,0,0,0,0,0,0,1
|
||||
|
||||
[Printing][Text]
|
||||
DontPrintFoldedCode=true
|
||||
Legend=false
|
||||
LineNumbers=false
|
||||
|
||||
[Shortcut Schemes]
|
||||
Current Scheme=Default
|
||||
|
||||
[Shortcuts]
|
||||
kate_mdi_focus_toolview_kate_private_plugin_katekonsoleplugin=;\s
|
||||
kate_mdi_sidebar_visibility=;\s
|
||||
kate_mdi_toolview_kate_private_plugin_katekonsoleplugin=;\s
|
||||
kate_mdi_toolview_kateproject=Ctrl+B
|
||||
kate_mdi_toolview_kateprojectinfo=Alt+T
|
||||
|
||||
[debugplugin]
|
||||
DAPConfiguration=
|
||||
|
||||
[filetree]
|
||||
editShade=183,220,246
|
||||
listMode=false
|
||||
middleClickToClose=false
|
||||
shadingEnabled=true
|
||||
showCloseButton=false
|
||||
showFullPathOnRoots=false
|
||||
showToolbar=true
|
||||
sortRole=0
|
||||
viewShade=211,190,222
|
||||
|
||||
[lspclient]
|
||||
AllowedServerCommandLines=/usr/bin/pylsp --check-parent-process
|
||||
AutoHover=true
|
||||
AutoImport=true
|
||||
BlockedServerCommandLines=
|
||||
CompletionDocumentation=true
|
||||
CompletionParens=true
|
||||
Diagnostics=true
|
||||
FormatOnSave=false
|
||||
HighlightGoto=true
|
||||
IncrementalSync=true
|
||||
InlayHints=false
|
||||
Messages=true
|
||||
ReferencesDeclaration=true
|
||||
SemanticHighlighting=true
|
||||
ServerConfiguration=
|
||||
SignatureHelp=true
|
||||
SymbolDetails=false
|
||||
SymbolExpand=true
|
||||
SymbolSort=false
|
||||
SymbolTree=true
|
||||
TypeFormatting=false
|
@ -3880,31 +3880,59 @@ class Command(enum.StrEnum):
|
||||
backup = 'backup'
|
||||
pip_resolve = 'pip_resolve'
|
||||
|
||||
def pip_resolve(args: list[str]) -> None:
|
||||
def pip_resolve(
|
||||
args: list[str],
|
||||
) -> None:
|
||||
from online.fxreader.pr34.commands_typed.pip import pip_resolve, pip_resolve_t
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
'-m', '--mode',
|
||||
choices=['copy_paste', 'monkey_patch'],
|
||||
choices=[
|
||||
o.value
|
||||
for o in pip_resolve_t.kwargs_t.mode_t
|
||||
],
|
||||
required=True,
|
||||
)
|
||||
parser.add_argument(
|
||||
'-r', '--requirement',
|
||||
default=[],
|
||||
dest='requirements',
|
||||
type=str,
|
||||
action='append',
|
||||
help=r'''
|
||||
requirement,
|
||||
can be multiple in a single parameter,
|
||||
all of them are to be split by whitespace
|
||||
and printed into a temp file,
|
||||
that is fed into uv pip compile
|
||||
''',
|
||||
)
|
||||
|
||||
|
||||
options, argv = parser.parse_known_args(args)
|
||||
|
||||
from online.fxreader.pr34.commands_typed.pip import pip_resolve
|
||||
sys.stdout.write('\n'.join([
|
||||
'#%s\n%s %s' % (
|
||||
o.url,
|
||||
o.constraint,
|
||||
' '.join([
|
||||
'--hash=sha256:%s' % o2
|
||||
for o2 in o.sha256
|
||||
])
|
||||
)
|
||||
for o in pip_resolve(
|
||||
argv,
|
||||
mode=options.mode,
|
||||
)
|
||||
]))
|
||||
requirements : Optional[list[str]] = []
|
||||
|
||||
for o in options.requirements:
|
||||
requirements.extend(o.split())
|
||||
|
||||
if len(requirements) == 0:
|
||||
requirements = None
|
||||
|
||||
options.mode = pip_resolve_t.kwargs_t.mode_t(
|
||||
options.mode
|
||||
)
|
||||
|
||||
resolve_res = pip_resolve(
|
||||
argv,
|
||||
mode=options.mode,
|
||||
requirements=requirements,
|
||||
)
|
||||
|
||||
assert not resolve_res.txt is None
|
||||
|
||||
sys.stdout.write(resolve_res.txt)
|
||||
sys.stdout.flush()
|
||||
|
||||
def commands_cli(
|
||||
|
@ -141,7 +141,10 @@ class CLI(abc.ABC):
|
||||
if not d.args is None:
|
||||
cmd.extend(d.args)
|
||||
|
||||
subprocess.check_call(cmd)
|
||||
subprocess.check_call(
|
||||
cmd,
|
||||
cwd=d.source_path,
|
||||
)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
@ -196,6 +199,7 @@ class CLI(abc.ABC):
|
||||
force: Optional[bool] = None,
|
||||
env: Optional[dict[str, str]] = None,
|
||||
mypy: bool = False,
|
||||
tests: bool = False,
|
||||
) -> None:
|
||||
project = self.projects[project_name]
|
||||
|
||||
@ -212,6 +216,11 @@ class CLI(abc.ABC):
|
||||
# assert argv is None or len(argv) == 0
|
||||
|
||||
if not project.meson_path is None:
|
||||
if tests:
|
||||
self.meson_test(
|
||||
project_name=project_name,
|
||||
)
|
||||
|
||||
self.meson_install(
|
||||
project_name=project_name,
|
||||
force=force,
|
||||
@ -257,6 +266,16 @@ class CLI(abc.ABC):
|
||||
env=dict(list(os.environ.items())) | env,
|
||||
)
|
||||
|
||||
if tests:
|
||||
subprocess.check_call(
|
||||
[
|
||||
'ninja',
|
||||
'-C',
|
||||
str(project.build_dir / 'pyproject'),
|
||||
'test',
|
||||
]
|
||||
)
|
||||
|
||||
def meson_install(
|
||||
self,
|
||||
project_name: str,
|
||||
@ -316,6 +335,25 @@ class CLI(abc.ABC):
|
||||
*argv,
|
||||
])
|
||||
|
||||
def meson_test(
|
||||
self,
|
||||
project_name: str,
|
||||
argv: Optional[list[str]] = None,
|
||||
) -> None:
|
||||
project = self.projects[project_name]
|
||||
|
||||
if argv is None:
|
||||
argv = []
|
||||
|
||||
subprocess.check_call([
|
||||
shutil_which('meson', True,),
|
||||
'test',
|
||||
'-C',
|
||||
project.build_dir / 'meson',
|
||||
*argv,
|
||||
])
|
||||
|
||||
|
||||
def meson_compile(
|
||||
self,
|
||||
project_name: str,
|
||||
|
@ -115,8 +115,21 @@ def env_bootstrap(
|
||||
bootstrap_settings: BootstrapSettings,
|
||||
pyproject: PyProject,
|
||||
) -> None:
|
||||
pip_find_links : list[pathlib.Path] = []
|
||||
|
||||
if not pyproject.pip_find_links is None:
|
||||
pip_find_links.extend(pyproject.pip_find_links)
|
||||
|
||||
pip_find_links_args = sum([
|
||||
['-f', str(o),]
|
||||
for o in pip_find_links
|
||||
], [])
|
||||
|
||||
subprocess.check_call([
|
||||
'uv', 'venv', '--seed', '--offline',
|
||||
'uv', 'venv',
|
||||
*pip_find_links_args,
|
||||
# '--seed',
|
||||
'--offline',
|
||||
str(bootstrap_settings.env_path)
|
||||
])
|
||||
|
||||
@ -124,16 +137,18 @@ def env_bootstrap(
|
||||
'uv',
|
||||
'pip',
|
||||
'install',
|
||||
*pip_find_links_args,
|
||||
'-p',
|
||||
bootstrap_settings.python_path,
|
||||
'--offline',
|
||||
'uv',
|
||||
'uv', 'pip',
|
||||
])
|
||||
|
||||
subprocess.check_call([
|
||||
bootstrap_settings.python_path,
|
||||
'-m',
|
||||
'uv', 'pip', 'install',
|
||||
*pip_find_links_args,
|
||||
'--offline',
|
||||
'build', 'setuptools', 'meson-python', 'pybind11',
|
||||
])
|
||||
@ -153,11 +168,6 @@ def env_bootstrap(
|
||||
# *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([
|
||||
pyproject.dependencies[o]
|
||||
@ -173,10 +183,7 @@ def env_bootstrap(
|
||||
bootstrap_settings.python_path,
|
||||
'-m',
|
||||
'uv', 'pip', 'install',
|
||||
*sum([
|
||||
['-f', str(o),]
|
||||
for o in pip_find_links
|
||||
], []),
|
||||
*pip_find_links_args,
|
||||
# '-f', str(pathlib.Path(__file__).parent / 'deps' / 'dist'),
|
||||
'--offline',
|
||||
*early_dependencies,
|
||||
|
@ -1,34 +1,54 @@
|
||||
import contextlib
|
||||
import pathlib
|
||||
import sys
|
||||
import enum
|
||||
import dataclasses
|
||||
import pip._internal.commands.show
|
||||
import pip._internal.commands.download
|
||||
import pip._internal.cli.main_parser
|
||||
import pip._internal.models.index
|
||||
import pip._internal.utils.temp_dir
|
||||
import pip._internal.cli.main
|
||||
import pip._internal.network.download
|
||||
import pip._internal.resolution.base
|
||||
import pip._internal.resolution.resolvelib.resolver
|
||||
import pip._internal.operations.prepare
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import unittest.mock
|
||||
import logging
|
||||
import typing
|
||||
|
||||
from typing import (Literal,)
|
||||
if typing.TYPE_CHECKING:
|
||||
import pip._internal.commands.show
|
||||
import pip._internal.commands.download
|
||||
import pip._internal.cli.main_parser
|
||||
import pip._internal.models.index
|
||||
import pip._internal.utils.temp_dir
|
||||
import pip._internal.cli.main
|
||||
import pip._internal.network.download
|
||||
import pip._internal.resolution.base
|
||||
import pip._internal.resolution.resolvelib.resolver
|
||||
import pip._internal.operations.prepare
|
||||
|
||||
from typing import (
|
||||
Literal, Optional, Iterable, Any,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def pip_show(
|
||||
argv: list[str],
|
||||
) -> list[pip._internal.commands.show._PackageInfo]:
|
||||
) -> list['pip._internal.commands.show._PackageInfo']:
|
||||
import pip._internal.commands.show
|
||||
return list(
|
||||
pip._internal.commands.show.search_packages_info(
|
||||
argv,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class pip_resolve_t:
|
||||
class kwargs_t:
|
||||
class mode_t(enum.StrEnum):
|
||||
copy_paste = "copy_paste"
|
||||
monkey_patch = "monkey_patch"
|
||||
uv_pip_freeze = "uv_pip_freeze"
|
||||
uv_pip_compile = "uv_pip_compile"
|
||||
|
||||
@dataclasses.dataclass
|
||||
class res_t:
|
||||
@dataclasses.dataclass
|
||||
class download_info_t:
|
||||
@ -36,29 +56,58 @@ class pip_resolve_t:
|
||||
sha256: str
|
||||
constraint: str
|
||||
|
||||
txt: Optional[str] = None
|
||||
entries: Optional[list[download_info_t]] = None
|
||||
|
||||
|
||||
def pip_resolve_entries_to_txt(
|
||||
entries: list[pip_resolve_t.res_t.download_info_t]
|
||||
) -> str:
|
||||
return '\n'.join([
|
||||
'#%s\n%s %s' % (
|
||||
o.url,
|
||||
o.constraint,
|
||||
' '.join([
|
||||
'--hash=sha256:%s' % o2
|
||||
for o2 in o.sha256
|
||||
])
|
||||
)
|
||||
for o in entries
|
||||
])
|
||||
|
||||
def pip_resolve(
|
||||
argv: list[str],
|
||||
mode: Literal['copy_paste', 'monkey_patch'],
|
||||
) -> list[
|
||||
pip_resolve_t.res_t.download_info_t
|
||||
]:
|
||||
if mode == 'copy_paste':
|
||||
mode: pip_resolve_t.kwargs_t.mode_t,
|
||||
requirements: Optional[list[str]] = None,
|
||||
) -> pip_resolve_t.res_t:
|
||||
if mode is pip_resolve_t.kwargs_t.mode_t.copy_paste:
|
||||
import pip._internal.commands.show
|
||||
import pip._internal.commands.download
|
||||
import pip._internal.cli.cmdoptions
|
||||
import pip._internal.cli.main_parser
|
||||
import pip._internal.models.index
|
||||
import pip._internal.utils.temp_dir
|
||||
import pip._internal.cli.main
|
||||
import pip._internal.network.download
|
||||
import pip._internal.resolution.base
|
||||
import pip._internal.req.req_install
|
||||
import pip._internal.resolution.resolvelib.resolver
|
||||
import pip._internal.operations.prepare
|
||||
import pip._internal.utils.temp_dir
|
||||
import pip._internal.operations.build.build_tracker
|
||||
import pip._internal.models.direct_url
|
||||
|
||||
with contextlib.ExitStack() as stack:
|
||||
stack.enter_context(
|
||||
pip._internal.utils.temp_dir.global_tempdir_manager()
|
||||
)
|
||||
stack.enter_context(pip._internal.utils.temp_dir.global_tempdir_manager())
|
||||
|
||||
t2 = pip._internal.cli.main_parser.create_main_parser()
|
||||
|
||||
t3 = t2.parse_args(['download'])
|
||||
t1 = pip._internal.commands.download.DownloadCommand(
|
||||
'blah',
|
||||
'shit'
|
||||
)
|
||||
t3 = t2.parse_args(["download"])
|
||||
t1 = pip._internal.commands.download.DownloadCommand("blah", "shit")
|
||||
|
||||
stack.enter_context(t1.main_context())
|
||||
|
||||
#options = pip._internal.commands.download.Values()
|
||||
# options = pip._internal.commands.download.Values()
|
||||
options = t3[0]
|
||||
options.python_version = None
|
||||
options.platforms = []
|
||||
@ -82,28 +131,33 @@ def pip_resolve(
|
||||
options.check_build_deps = None
|
||||
options.progress_bar = True
|
||||
options.require_hashes = None
|
||||
options.ignore_requires_python = None
|
||||
#options.cache_dir
|
||||
pip._internal.commands.download.cmdoptions.check_dist_restriction(options)
|
||||
options.ignore_requires_python = False
|
||||
# options.cache_dir
|
||||
pip._internal.cli.cmdoptions.check_dist_restriction(options)
|
||||
# t1._in_main_context = True
|
||||
session = t1.get_default_session(options)
|
||||
target_python = pip._internal.commands.download.make_target_python(options)
|
||||
target_python = pip._internal.cli.cmdoptions.make_target_python(options)
|
||||
finder = t1._build_package_finder(
|
||||
options=options,
|
||||
session=session,
|
||||
target_python=target_python,
|
||||
ignore_requires_python=options.ignore_requires_python,
|
||||
)
|
||||
build_tracker = t1.enter_context(pip._internal.commands.download.get_build_tracker())
|
||||
reqs = t1.get_requirements([
|
||||
#'pip', 'uv', 'ipython',
|
||||
*argv,
|
||||
], options, finder, session)
|
||||
pip._internal.commands.download.check_legacy_setup_py_options(options, reqs)
|
||||
directory = pip._internal.commands.download.TempDirectory(
|
||||
delete=True,
|
||||
kind='download',
|
||||
globally_managed=True
|
||||
build_tracker = t1.enter_context(
|
||||
pip._internal.operations.build.build_tracker.get_build_tracker()
|
||||
)
|
||||
reqs = t1.get_requirements(
|
||||
[
|
||||
#'pip', 'uv', 'ipython',
|
||||
*argv,
|
||||
],
|
||||
options,
|
||||
finder,
|
||||
session,
|
||||
)
|
||||
pip._internal.req.req_install.check_legacy_setup_py_options(options, reqs)
|
||||
directory = pip._internal.utils.temp_dir.TempDirectory(
|
||||
delete=True, kind="download", globally_managed=True
|
||||
)
|
||||
preparer = t1.make_requirement_preparer(
|
||||
temp_build_dir=directory,
|
||||
@ -126,49 +180,127 @@ def pip_resolve(
|
||||
t1.trace_basic_info(finder)
|
||||
requirement_set = resolver.resolve(reqs, check_supported_wheels=True)
|
||||
|
||||
return [
|
||||
pip_resolve_t.res_t.download_info_t(
|
||||
constraint=k,
|
||||
sha256=v.download_info.info.hashes['sha256'],
|
||||
url=v.download_info.url,
|
||||
res = pip_resolve_t.res_t()
|
||||
|
||||
res.entries = []
|
||||
|
||||
for k, v in requirement_set.requirements.items():
|
||||
assert not v.download_info is None
|
||||
assert isinstance(
|
||||
v.download_info.info,
|
||||
pip._internal.models.direct_url.ArchiveInfo,
|
||||
)
|
||||
for k, v in requirement_set.requirements.items()
|
||||
]
|
||||
elif mode == 'monkey_patch':
|
||||
assert not v.download_info.info.hashes is None
|
||||
|
||||
res.entries.append(
|
||||
pip_resolve_t.res_t.download_info_t(
|
||||
constraint=k,
|
||||
sha256=v.download_info.info.hashes["sha256"],
|
||||
url=v.download_info.url,
|
||||
)
|
||||
)
|
||||
|
||||
res.txt = pip_resolve_entries_to_txt(
|
||||
res.entries
|
||||
)
|
||||
|
||||
return res
|
||||
elif mode is pip_resolve_t.kwargs_t.mode_t.monkey_patch:
|
||||
import pip._internal.commands.show
|
||||
import pip._internal.commands.download
|
||||
import pip._internal.cli.main_parser
|
||||
import pip._internal.models.index
|
||||
import pip._internal.models.link
|
||||
from pip._internal.models.link import (
|
||||
Link,
|
||||
)
|
||||
import pip._internal.utils.temp_dir
|
||||
from pip._internal.metadata.base import (
|
||||
BaseDistribution,
|
||||
)
|
||||
import pip._internal.cli.main
|
||||
import pip._internal.network.download
|
||||
import pip._internal.resolution.base
|
||||
import pip._internal.resolution.resolvelib.resolver
|
||||
import pip._internal.operations.prepare
|
||||
from pip._internal.network.download import (
|
||||
Downloader,
|
||||
)
|
||||
from pip._internal.operations.prepare import (
|
||||
File,
|
||||
)
|
||||
from pip._internal.req.req_set import RequirementSet
|
||||
from pip._internal.utils.hashes import Hashes
|
||||
from pip._internal.req.req_install import InstallRequirement
|
||||
|
||||
downloader_call_def = pip._internal.network.download.Downloader.__call__
|
||||
|
||||
def downloader_call(*args):
|
||||
logger.info(dict(
|
||||
url=args[1].url,
|
||||
))
|
||||
def downloader_call(
|
||||
_self: pip._internal.network.download.Downloader,
|
||||
link: pip._internal.models.link.Link,
|
||||
location: str,
|
||||
) -> tuple[str, str]:
|
||||
logger.info(
|
||||
dict(
|
||||
url=link.url,
|
||||
)
|
||||
)
|
||||
|
||||
return downloader_call_def(*args)
|
||||
return downloader_call_def(
|
||||
_self,
|
||||
link, location,
|
||||
)
|
||||
|
||||
batch_downloader_call_def = pip._internal.network.download.BatchDownloader.__call__
|
||||
batch_downloader_call_def = (
|
||||
pip._internal.network.download.BatchDownloader.__call__
|
||||
)
|
||||
|
||||
def batch_downloader_call(*args):
|
||||
def batch_downloader_call(
|
||||
_self: pip._internal.network.download.BatchDownloader,
|
||||
links: Iterable[pip._internal.models.link.Link],
|
||||
location: str,
|
||||
) -> Iterable[
|
||||
tuple[
|
||||
pip._internal.models.link.Link,
|
||||
tuple[str, str]
|
||||
]
|
||||
]:
|
||||
# print(args)
|
||||
|
||||
logger.info(dict(
|
||||
args=args,
|
||||
))
|
||||
logger.info(
|
||||
dict(
|
||||
links=links,
|
||||
location=location,
|
||||
)
|
||||
)
|
||||
|
||||
return [
|
||||
(o, ('/dev/null', None))
|
||||
for o in args[1]
|
||||
(o, ("/dev/null", ''))
|
||||
for o in links
|
||||
]
|
||||
|
||||
#base_resolver_resolve_def = pip._internal.resolution.base.BaseResolver.resolve
|
||||
base_resolver_resolve_def = pip._internal.resolution.resolvelib.resolver.Resolver.resolve
|
||||
# base_resolver_resolve_def = pip._internal.resolution.base.BaseResolver.resolve
|
||||
base_resolver_resolve_def = (
|
||||
pip._internal.resolution.resolvelib.resolver.Resolver.resolve
|
||||
)
|
||||
|
||||
result_requirements = []
|
||||
result_requirements : list[
|
||||
RequirementSet | InstallRequirement
|
||||
] = []
|
||||
|
||||
def base_resolver_resolve(*args, **kwargs):
|
||||
def base_resolver_resolve(
|
||||
_self: pip._internal.resolution.resolvelib.resolver.Resolver,
|
||||
root_reqs: list[
|
||||
InstallRequirement,
|
||||
],
|
||||
check_supported_wheels: bool,
|
||||
) -> RequirementSet:
|
||||
# print(args, kwargs)
|
||||
|
||||
res = base_resolver_resolve_def(
|
||||
*args,
|
||||
**kwargs
|
||||
_self,
|
||||
root_reqs,
|
||||
check_supported_wheels
|
||||
)
|
||||
|
||||
result_requirements.append(res)
|
||||
@ -177,18 +309,27 @@ def pip_resolve(
|
||||
|
||||
get_http_url_def = pip._internal.operations.prepare.get_http_url
|
||||
|
||||
def get_http_url(link, download, download_dir=None, hashes=None):
|
||||
def get_http_url(
|
||||
link: Link,
|
||||
download: Downloader,
|
||||
download_dir: Optional[str] = None,
|
||||
hashes: Optional[Hashes] = None,
|
||||
) -> File:
|
||||
logger.info(
|
||||
dict(
|
||||
url=link.url,
|
||||
hashes=hashes,
|
||||
)
|
||||
)
|
||||
|
||||
logger.info(dict(
|
||||
url=link.url,
|
||||
hashes=hashes,
|
||||
))
|
||||
|
||||
if link.url.endswith('.whl'):
|
||||
print('blah')
|
||||
if link.url.endswith(".whl"):
|
||||
print("blah")
|
||||
hashes = None
|
||||
|
||||
return '/dev/null', None
|
||||
return File(
|
||||
"/dev/null",
|
||||
'',
|
||||
)
|
||||
else:
|
||||
return get_http_url_def(
|
||||
link,
|
||||
@ -197,89 +338,94 @@ def pip_resolve(
|
||||
hashes
|
||||
)
|
||||
|
||||
prepare_linked_requirements_more_def = \
|
||||
pip._internal.operations.prepare.RequirementPreparer\
|
||||
.prepare_linked_requirements_more
|
||||
prepare_linked_requirements_more_def = pip._internal.operations.prepare.RequirementPreparer.prepare_linked_requirements_more
|
||||
|
||||
def prepare_linked_requirements_more(
|
||||
_self, reqs, *args, **kwargs
|
||||
):
|
||||
result_requirements.append(reqs)
|
||||
_self: pip._internal.resolution.resolvelib.resolver.Resolver,
|
||||
reqs: Iterable[InstallRequirement],
|
||||
parallel_builds: bool = False,
|
||||
) -> None:
|
||||
result_requirements.extend(
|
||||
reqs
|
||||
)
|
||||
raise NotImplementedError
|
||||
|
||||
_complete_partial_requirements_def = \
|
||||
pip._internal.operations.prepare.RequirementPreparer\
|
||||
._complete_partial_requirements
|
||||
_complete_partial_requirements_def = pip._internal.operations.prepare.RequirementPreparer._complete_partial_requirements
|
||||
|
||||
def _complete_partial_requirements(
|
||||
_self, reqs, *args, **kwargs
|
||||
):
|
||||
result_requirements.append(reqs)
|
||||
_self: pip._internal.resolution.resolvelib.resolver.Resolver,
|
||||
partially_downloaded_reqs: Iterable[InstallRequirement],
|
||||
parallel_builds: bool = False,
|
||||
) -> None:
|
||||
result_requirements.extend(
|
||||
partially_downloaded_reqs
|
||||
)
|
||||
raise NotImplementedError
|
||||
|
||||
patches = []
|
||||
patches : list[Any] = []
|
||||
|
||||
patches.append(
|
||||
unittest.mock.patch.object(
|
||||
pip._internal.network.download.Downloader,
|
||||
'__call__',
|
||||
downloader_call
|
||||
pip._internal.network.download.Downloader, "__call__", downloader_call
|
||||
)
|
||||
)
|
||||
#patches.append(
|
||||
# patches.append(
|
||||
# unittest.mock.patch.object(
|
||||
# pip._internal.network.download.BatchDownloader,
|
||||
# '__call__',
|
||||
# batch_downloader_call
|
||||
# )
|
||||
#)
|
||||
#patches.append(
|
||||
# )
|
||||
# patches.append(
|
||||
# unittest.mock.patch.object(
|
||||
# pip._internal.resolution.base.BaseResolver, 'resolve', base_resolver_resolve))
|
||||
|
||||
patches.append(
|
||||
unittest.mock.patch.object(
|
||||
pip._internal.resolution.resolvelib.resolver.Resolver,
|
||||
'resolve',
|
||||
base_resolver_resolve
|
||||
"resolve",
|
||||
base_resolver_resolve,
|
||||
)
|
||||
)
|
||||
patches.append(
|
||||
unittest.mock.patch.object(
|
||||
pip._internal.operations.prepare,
|
||||
'get_http_url',
|
||||
"get_http_url",
|
||||
get_http_url,
|
||||
)
|
||||
)
|
||||
patches.append(
|
||||
unittest.mock.patch.object(
|
||||
pip._internal.operations.prepare.RequirementPreparer,
|
||||
'prepare_linked_requirements_more',
|
||||
prepare_linked_requirements_more
|
||||
"prepare_linked_requirements_more",
|
||||
prepare_linked_requirements_more,
|
||||
)
|
||||
)
|
||||
#patches.append(
|
||||
# patches.append(
|
||||
# unittest.mock.patch.object(
|
||||
# pip._internal.operations.prepare.RequirementPreparer,
|
||||
# '_complete_partial_requirements',
|
||||
# _complete_partial_requirements
|
||||
# )
|
||||
#)
|
||||
# )
|
||||
|
||||
with contextlib.ExitStack() as stack:
|
||||
for p in patches:
|
||||
stack.enter_context(p)
|
||||
|
||||
pip._internal.cli.main.main([
|
||||
'download',
|
||||
'-q',
|
||||
'--no-cache',
|
||||
'-d',
|
||||
'/dev/null',
|
||||
*argv,
|
||||
# 'numpy',
|
||||
])
|
||||
pip._internal.cli.main.main(
|
||||
[
|
||||
"download",
|
||||
"-q",
|
||||
"--no-cache",
|
||||
"-d",
|
||||
"/dev/null",
|
||||
*argv,
|
||||
# 'numpy',
|
||||
]
|
||||
)
|
||||
|
||||
#return sum([
|
||||
# return sum([
|
||||
# [
|
||||
# pip_resolve_t.res_t.download_info_t(
|
||||
# constraint=k,
|
||||
@ -289,15 +435,90 @@ def pip_resolve(
|
||||
# for k, v in o.requirements.items()
|
||||
# ]
|
||||
# for o in result_requirements
|
||||
#], [])
|
||||
# ], [])
|
||||
logger.warn(result_requirements)
|
||||
return [
|
||||
pip_resolve_t.res_t.download_info_t(
|
||||
constraint=str(o.req),
|
||||
sha256=o.hashes()._allowed['sha256'],
|
||||
url=o.link.url,
|
||||
|
||||
res = pip_resolve_t.res_t()
|
||||
|
||||
res.entries = []
|
||||
|
||||
for o in result_requirements:
|
||||
assert isinstance(o, InstallRequirement)
|
||||
|
||||
sha256_hashes = o.hashes()._allowed["sha256"]
|
||||
assert len(sha256_hashes) == 1
|
||||
assert not o.link is None
|
||||
|
||||
res.entries.append(
|
||||
pip_resolve_t.res_t.download_info_t(
|
||||
constraint=str(o.req),
|
||||
sha256=sha256_hashes[0],
|
||||
url=o.link.url,
|
||||
)
|
||||
)
|
||||
|
||||
res.txt = pip_resolve_entries_to_txt(
|
||||
res.entries
|
||||
)
|
||||
|
||||
return res
|
||||
elif mode is pip_resolve_t.kwargs_t.mode_t.uv_pip_freeze:
|
||||
assert len(argv) == 0
|
||||
|
||||
pip_freeze = subprocess.check_output(
|
||||
[
|
||||
sys.executable,
|
||||
"-m",
|
||||
"uv",
|
||||
"pip",
|
||||
"freeze",
|
||||
],
|
||||
).decode('utf-8')
|
||||
pip_compile = subprocess.check_output(
|
||||
[
|
||||
sys.executable, '-m',
|
||||
'uv', 'pip', 'compile',
|
||||
'--generate-hashes',
|
||||
'-',
|
||||
|
||||
],
|
||||
input=pip_freeze.encode('utf-8')
|
||||
).decode('utf-8')
|
||||
|
||||
return pip_resolve_t.res_t(
|
||||
txt=pip_compile,
|
||||
)
|
||||
elif mode is pip_resolve_t.kwargs_t.mode_t.uv_pip_compile:
|
||||
with contextlib.ExitStack() as stack:
|
||||
if not requirements is None:
|
||||
# assert len(argv) == 0
|
||||
|
||||
f = stack.enter_context(
|
||||
tempfile.NamedTemporaryFile(
|
||||
suffix='.txt',
|
||||
)
|
||||
)
|
||||
f.write(
|
||||
('\n'.join(requirements)).encode('utf-8')
|
||||
)
|
||||
f.flush()
|
||||
|
||||
argv.append(f.name)
|
||||
|
||||
if argv[0] == '--':
|
||||
del argv[0]
|
||||
|
||||
pip_compile = subprocess.check_output(
|
||||
[
|
||||
sys.executable, '-m',
|
||||
'uv', 'pip', 'compile',
|
||||
'--generate-hashes',
|
||||
*argv,
|
||||
],
|
||||
).decode('utf-8')
|
||||
|
||||
return pip_resolve_t.res_t(
|
||||
txt=pip_compile,
|
||||
)
|
||||
for o in sum(result_requirements, [])
|
||||
]
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = 'online.fxreader.pr34'
|
||||
version = '0.1.4.9'
|
||||
version = '0.1.4.12'
|
||||
|
||||
dependencies = [
|
||||
#"-r requirements.txt",
|
||||
|
@ -1 +0,0 @@
|
||||
python-build
|
@ -1,16 +0,0 @@
|
||||
ipython
|
||||
jupyter
|
||||
notebook
|
||||
requests
|
||||
pyquery
|
||||
youtube-dl
|
||||
gdown
|
||||
aiohttp
|
||||
mypy
|
||||
ruff
|
||||
cython
|
||||
numpy
|
||||
scoping
|
||||
types-setuptools
|
||||
uvloop
|
||||
pydantic
|
Loading…
Reference in New Issue
Block a user