omlish 0.0.0.dev95__py3-none-any.whl → 0.0.0.dev96__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
omlish/__about__.py CHANGED
@@ -1,5 +1,5 @@
1
- __version__ = '0.0.0.dev95'
2
- __revision__ = '40763ed67700ccfb9317c5f357737baadbc16159'
1
+ __version__ = '0.0.0.dev96'
2
+ __revision__ = '0cb14143907ab35daec49550a83b060cb60de483'
3
3
 
4
4
 
5
5
  #
omlish/bootstrap/diag.py CHANGED
@@ -169,17 +169,12 @@ class TimebombBootstrap(ContextBootstrap['TimebombBootstrap.Config']):
169
169
  class PycharmBootstrap(SimpleBootstrap['PycharmBootstrap.Config']):
170
170
  @dc.dataclass(frozen=True)
171
171
  class Config(Bootstrap.Config):
172
- debug_host: ta.Optional[str] = None
173
- debug_port: ta.Optional[int] = None
174
- version: ta.Optional[str] = None
172
+ debug: ta.Optional[str] = None
175
173
 
176
174
  def run(self) -> None:
177
- if self._config.debug_port is not None:
178
- diagpc.pycharm_remote_debugger_attach(
179
- self._config.debug_host,
180
- self._config.debug_port,
181
- version=self._config.version,
182
- )
175
+ if self._config.debug is not None:
176
+ prd = diagpc.PycharmRemoteDebugger.parse(self._config.debug)
177
+ diagpc.pycharm_remote_debugger_attach(prd)
183
178
 
184
179
 
185
180
  ##
@@ -1,4 +1,5 @@
1
1
  from .pycharm import ( # noqa
2
+ PycharmRemoteDebugger,
2
3
  get_pycharm_version,
3
4
  is_pycharm_hosted,
4
5
  pycharm_remote_debugger_attach,
@@ -1,5 +1,7 @@
1
+ import dataclasses as dc
1
2
  import os.path
2
3
  import plistlib
4
+ import re
3
5
  import subprocess
4
6
  import sys
5
7
  import typing as ta
@@ -106,12 +108,33 @@ def _import_pydevd_pycharm(*, version: str | None = None) -> ta.Any:
106
108
  return pydevd_pycharm
107
109
 
108
110
 
109
- def pycharm_remote_debugger_attach(
110
- host: str | None,
111
- port: int,
112
- *,
113
- version: str | None = None,
114
- ) -> None:
111
+ @dc.dataclass(frozen=True)
112
+ class PycharmRemoteDebugger:
113
+ host: str | None
114
+ port: int
115
+ version: str | None = None
116
+
117
+ def __str__(self) -> str:
118
+ return ''.join([
119
+ f'@{self.version}:' if self.version is not None else '',
120
+ f'{self.host}:' if self.host is not None else '',
121
+ str(self.port),
122
+ ])
123
+
124
+ @classmethod
125
+ def parse(cls, s: str) -> 'PycharmRemoteDebugger':
126
+ if (m := re.fullmatch(r'(@(?P<version>[^:]+):)?((?P<host>[^:]+):)?(?P<port>\d+)', s)) is None:
127
+ raise ValueError(s)
128
+ gd = m.groupdict()
129
+ return cls(
130
+ host=gd.get('host'),
131
+ port=int(gd['port']),
132
+ version=gd.get('version'),
133
+ )
134
+
135
+
136
+ def pycharm_remote_debugger_attach(prd: PycharmRemoteDebugger) -> None:
137
+ host = prd.host
115
138
  if host is None:
116
139
  if (
117
140
  sys.platform == 'linux' and
@@ -122,6 +145,7 @@ def pycharm_remote_debugger_attach(
122
145
  else:
123
146
  host = 'localhost'
124
147
 
148
+ version = prd.version
125
149
  if version is None and host in ('localhost', '127.0.0.1'):
126
150
  version = get_pycharm_version()
127
151
 
@@ -132,7 +156,7 @@ def pycharm_remote_debugger_attach(
132
156
 
133
157
  pydevd_pycharm.settrace(
134
158
  host,
135
- port=port,
159
+ port=prd.port,
136
160
  stdoutToServer=True,
137
161
  stderrToServer=True,
138
162
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: omlish
3
- Version: 0.0.0.dev95
3
+ Version: 0.0.0.dev96
4
4
  Summary: omlish
5
5
  Author: wrmsr
6
6
  License: BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  omlish/.manifests.json,sha256=hTFp9tvE72BxKloIq1s1SS0LRQlIsvMtO69Sbc47rKg,1704
2
- omlish/__about__.py,sha256=CrlzN0XqTgVfMvKp_IYNBS-xeNlXgZLdXijAy8GS_kY,3345
2
+ omlish/__about__.py,sha256=xYYDai8LigmF6omaHMQLajgl5laeQZWUoKdsMxJXys4,3345
3
3
  omlish/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  omlish/argparse.py,sha256=Dc73G8lyoQBLvXhMYUbzQUh4SJu_OTvKUXjSUxq_ang,7499
5
5
  omlish/c3.py,sha256=4vogWgwPb8TbNS2KkZxpoWbwjj7MuHG2lQG-hdtkvjI,8062
@@ -89,7 +89,7 @@ omlish/asyncs/trio_asyncio.py,sha256=oqdOHy0slj9PjVxaDf3gJkq9AAgg7wYZbB469jOftVw
89
89
  omlish/bootstrap/__init__.py,sha256=-Rtsg7uPQNhh1dIT9nqrz96XlqizwoLnWf-FwOEstJI,730
90
90
  omlish/bootstrap/__main__.py,sha256=4jCwsaogp0FrJjJZ85hzF4-WqluPeheHbfeoKynKvNs,194
91
91
  omlish/bootstrap/base.py,sha256=d8hqn4hp1XMMi5PgcJBQXPKmW47epu8CxBlqDZiRZb4,1073
92
- omlish/bootstrap/diag.py,sha256=LADLhusbJ1tKxVD8-gmia1HShX1VeszRO1OApIQhSpI,5507
92
+ omlish/bootstrap/diag.py,sha256=iemH0nQEHEDzyZztvd_ygGGVpRpgn5UG6naxeQTvXp0,5347
93
93
  omlish/bootstrap/harness.py,sha256=VW8YP-yENGyXIuJ8GL_xintArF13nafwpz-iAghPt34,1967
94
94
  omlish/bootstrap/main.py,sha256=yZhOHDDlj4xB5a89dRdT8z58FsqqnpoBg1-tvY2CJe4,5903
95
95
  omlish/bootstrap/marshal.py,sha256=ZxdAeMNd2qXRZ1HUK89HmEhz8tqlS9OduW34QBscKw0,516
@@ -159,9 +159,9 @@ omlish/diag/pydevd.py,sha256=tHI0fc2ZaYKudUWTRuUe5B66qGeNktPC49ZKb8x0rSY,7298
159
159
  omlish/diag/threads.py,sha256=1-x02VCDZ407gfbtXm1pWK-ubqhqfePm9PMqkHCVoqk,3642
160
160
  omlish/diag/_pycharm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
161
161
  omlish/diag/_pycharm/runhack.py,sha256=eJlaUXIcFzAjOop_793RwNS_KF9NmhLv0i22xRVVeo0,34951
162
- omlish/diag/pycharm/__init__.py,sha256=sT-ub7flKeCCbM_i32z9-eGV8hgGJ45hwdcqtGDkVRY,153
162
+ omlish/diag/pycharm/__init__.py,sha256=-hZryZ3RfuoH4arwhBl-RmCZ6j-ybuUIEUf9C8o37iY,180
163
163
  omlish/diag/pycharm/cli.py,sha256=7SRh6yj8S5YGda4bq9BD4Kzwtgg4_Wa-K202ReZN2iI,1011
164
- omlish/diag/pycharm/pycharm.py,sha256=g-IfF8FBH93o6k_KDrLy8kIiFSLe3n39I2URipfFy0Q,3115
164
+ omlish/diag/pycharm/pycharm.py,sha256=GFcnkNedY3bbwRM3l7_9lFiaW9BcxOB0KZl01Nk_xPs,3854
165
165
  omlish/diag/replserver/__init__.py,sha256=uLo6V2aQ29v9z3IMELlPDSlG3_2iOT4-_X8VniF-EgE,235
166
166
  omlish/diag/replserver/__main__.py,sha256=LmU41lQ58bm1h4Mx7S8zhE_uEBSC6kPcp9mn5JRpulA,32
167
167
  omlish/diag/replserver/console.py,sha256=XzBDVhYlr8FY6ym4OwoaIHuFOHnGK3dTYlMDIOMUUlA,7410
@@ -457,9 +457,9 @@ omlish/text/delimit.py,sha256=ubPXcXQmtbOVrUsNh5gH1mDq5H-n1y2R4cPL5_DQf68,4928
457
457
  omlish/text/glyphsplit.py,sha256=Ug-dPRO7x-OrNNr8g1y6DotSZ2KH0S-VcOmUobwa4B0,3296
458
458
  omlish/text/indent.py,sha256=6Jj6TFY9unaPa4xPzrnZemJ-fHsV53IamP93XGjSUHs,1274
459
459
  omlish/text/parts.py,sha256=7vPF1aTZdvLVYJ4EwBZVzRSy8XB3YqPd7JwEnNGGAOo,6495
460
- omlish-0.0.0.dev95.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
461
- omlish-0.0.0.dev95.dist-info/METADATA,sha256=PTGAL5lZAs2yviTLTiaEtMx1B4hL3uInPDX8T8sWDAI,3987
462
- omlish-0.0.0.dev95.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
463
- omlish-0.0.0.dev95.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
464
- omlish-0.0.0.dev95.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
465
- omlish-0.0.0.dev95.dist-info/RECORD,,
460
+ omlish-0.0.0.dev96.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
461
+ omlish-0.0.0.dev96.dist-info/METADATA,sha256=iXdvwNxhVdlcnIH8lTiXDRPrhbVOy6uHDmpchaAJPsE,3987
462
+ omlish-0.0.0.dev96.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
463
+ omlish-0.0.0.dev96.dist-info/entry_points.txt,sha256=Lt84WvRZJskWCAS7xnQGZIeVWksprtUHj0llrvVmod8,35
464
+ omlish-0.0.0.dev96.dist-info/top_level.txt,sha256=pePsKdLu7DvtUiecdYXJ78iO80uDNmBlqe-8hOzOmfs,7
465
+ omlish-0.0.0.dev96.dist-info/RECORD,,