polyapi-python 0.3.18.dev5__py3-none-any.whl → 0.3.18.dev6__py3-none-any.whl

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.
polyapi/cli.py CHANGED
@@ -1,4 +1,6 @@
1
1
  import os
2
+ import sys
3
+ import tempfile
2
4
  import argparse
3
5
 
4
6
  from polyapi.utils import print_green, print_red
@@ -23,6 +25,16 @@ def _get_version_string():
23
25
 
24
26
 
25
27
  def execute_from_cli():
28
+ # Redirect __pycache__ out of generated dirs to avoid window file-locking
29
+ # failures when rmtree dels on generate.
30
+ if 'PYTHONPYCACHEPREFIX' not in os.environ:
31
+ cache_dir = os.path.join(tempfile.gettempdir(), 'polyapi_pycache')
32
+ os.makedirs(cache_dir, exist_ok=True)
33
+ # here for children just in case
34
+ os.environ['PYTHONPYCACHEPREFIX'] = cache_dir
35
+ # For the startup py_initialize issue
36
+ sys.pycache_prefix = cache_dir
37
+
26
38
  # First we setup all our argument parsing logic
27
39
  # Then we parse the arguments (waaay at the bottom)
28
40
  parser = argparse.ArgumentParser(
polyapi/generate.py CHANGED
@@ -4,6 +4,7 @@ import uuid
4
4
  import shutil
5
5
  import logging
6
6
  import tempfile
7
+ import stat
7
8
 
8
9
  from copy import deepcopy
9
10
  from typing import Any, List, Optional, Tuple, cast
@@ -209,23 +210,33 @@ def get_tables(specs: List[SpecificationDto]) -> List[TableSpecDto]:
209
210
  return [cast(TableSpecDto, spec) for spec in specs if spec["type"] == "table"]
210
211
 
211
212
 
213
+ def _rmtree_readonly_handler(func, path, exc):
214
+ # Windows marks __pycache__ .pyc files read-only; clear the bit and retry.
215
+ os.chmod(path, stat.S_IWRITE)
216
+ func(path)
217
+
218
+
219
+ def _rmtree(path):
220
+ shutil.rmtree(path, onerror=_rmtree_readonly_handler)
221
+
222
+
212
223
  def remove_old_library():
213
224
  currdir = os.path.dirname(os.path.abspath(__file__))
214
225
  path = os.path.join(currdir, "poly")
215
226
  if os.path.exists(path):
216
- shutil.rmtree(path)
227
+ _rmtree(path)
217
228
 
218
229
  path = os.path.join(currdir, "vari")
219
230
  if os.path.exists(path):
220
- shutil.rmtree(path)
231
+ _rmtree(path)
221
232
 
222
233
  path = os.path.join(currdir, "schemas")
223
234
  if os.path.exists(path):
224
- shutil.rmtree(path)
235
+ _rmtree(path)
225
236
 
226
237
  path = os.path.join(currdir, "tabi")
227
238
  if os.path.exists(path):
228
- shutil.rmtree(path)
239
+ _rmtree(path)
229
240
 
230
241
 
231
242
  def create_empty_schemas_module():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: polyapi-python
3
- Version: 0.3.18.dev5
3
+ Version: 0.3.18.dev6
4
4
  Summary: The Python Client for PolyAPI, the IPaaS by Developers for Developers
5
5
  Author-email: PolyAPI <support@polyapi.io>
6
6
  License: MIT License
@@ -2,7 +2,7 @@ polyapi/__init__.py,sha256=vV1N9xtIMtpi4o-2jAI3775LkzRbC9JUo87MAnW9zgo,5201
2
2
  polyapi/__main__.py,sha256=V4zhAh_YGxno5f_KSrlkELxcuDh9bR3WSd0n-2r-qQQ,93
3
3
  polyapi/api.py,sha256=CzqX99GekhQJVqAAWlL03hUenIi_5iTln9cWgQzz6Ko,2784
4
4
  polyapi/auth.py,sha256=l0pGAoYvEWqa2TMsrM9GS8imXu3GsWvpn4eFPy1vksI,6195
5
- polyapi/cli.py,sha256=MMIR0WbKjDYrVVKa4yNBYYB--46ZIRZkvWGAM3xgek0,11134
5
+ polyapi/cli.py,sha256=wrBmpyieCqXnKPfpX2asL_0ApSYWze9p3wlCwJrtfRM,11635
6
6
  polyapi/cli_constants.py,sha256=eZnAqAo8HLxHH3cdAoGWbrsALAtEWJFXRdSS2lvQvzE,144
7
7
  polyapi/client.py,sha256=DW6ljG_xCwAo2yz23A9QfLooE6ZUDvSpdA4e_dCQjiQ,1418
8
8
  polyapi/config.py,sha256=dnowfPKEau5sA4zwBzLK_dYAHA-Wi3AOnMtDNsYwUmM,7520
@@ -12,7 +12,7 @@ polyapi/error_handler.py,sha256=I_e0iz6VM23FLVQWJljxs2NGcl_OODbi43OcbnqBlp8,2398
12
12
  polyapi/exceptions.py,sha256=Zh7i7eCUhDuXEdUYjatkLFTeZkrx1BJ1P5ePgbJ9eIY,89
13
13
  polyapi/execute.py,sha256=MeAmc5qsMQfnQPiHJK9Khkn_wrBxMoyMYYqmuFFPsRg,8779
14
14
  polyapi/function_cli.py,sha256=kKrecKCDNMmYtcOOCVF2KKOGjFUfWD2TbiVsyYQ84y8,4323
15
- polyapi/generate.py,sha256=LzQBm2GKYfAwTsJ36ViLr1ypzrudijj1qR0DRzp-Be0,21764
15
+ polyapi/generate.py,sha256=3AtJcqZj2oybZmQVzrQ8XQyvwEz51PztWvSNKXdNre0,22008
16
16
  polyapi/http_client.py,sha256=Pd6FYHGB6plWlBbwZD9LPP6FEicdp0wyLWHd_9jxsaY,2273
17
17
  polyapi/parser.py,sha256=pAkeuwp1Kn6bHXiIoj-DuXQ518PztQThIa8vztgsKLQ,21525
18
18
  polyapi/poly_schemas.py,sha256=JGMQbELPFw4V_0nA0o71WJKFTdxjCGoKqJvIid_Y-a4,10759
@@ -27,8 +27,8 @@ polyapi/typedefs.py,sha256=mfll-KrngOW0wzbvDNiIDaDkFMwbsT-MY5y5hzWj9RE,5642
27
27
  polyapi/utils.py,sha256=SfzK86nhg1wuGzbI53DEFKJ3JkxZ0yU-CZBd_caKbrQ,15313
28
28
  polyapi/variables.py,sha256=hfSDPGQK6YphNCa9MqE0W88WIFfqCQWgpBDWkExMq-A,7582
29
29
  polyapi/webhook.py,sha256=0ceLwHNjNd2Yx_8MX5jOIxiQ5Lwhy2pe81ProAuKon0,5108
30
- polyapi_python-0.3.18.dev5.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
31
- polyapi_python-0.3.18.dev5.dist-info/METADATA,sha256=zMwyubuUS-fqd9d9JQPaG3csk8oVqjzGkH41zRF0yvo,5915
32
- polyapi_python-0.3.18.dev5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
- polyapi_python-0.3.18.dev5.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
34
- polyapi_python-0.3.18.dev5.dist-info/RECORD,,
30
+ polyapi_python-0.3.18.dev6.dist-info/licenses/LICENSE,sha256=6b_I7aPVp8JXhqQwdw7_B84Ca0S4JGjHj0sr_1VOdB4,1068
31
+ polyapi_python-0.3.18.dev6.dist-info/METADATA,sha256=4a6DAm-_5mNNpeV1xNGdpauoTdCBQP_Vgy_pwbxRizQ,5915
32
+ polyapi_python-0.3.18.dev6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
33
+ polyapi_python-0.3.18.dev6.dist-info/top_level.txt,sha256=CEFllOnzowci_50RYJac-M54KD2IdAptFsayVVF_f04,8
34
+ polyapi_python-0.3.18.dev6.dist-info/RECORD,,