robotcode-plugin 0.100.0__tar.gz → 0.100.2__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: robotcode-plugin
3
- Version: 0.100.0
3
+ Version: 0.100.2
4
4
  Summary: Some classes for RobotCode plugin management
5
5
  Project-URL: Donate, https://opencollective.com/robotcode
6
6
  Project-URL: Documentation, https://github.com/robotcodedev/robotcode#readme
@@ -1,4 +1,5 @@
1
1
  import dataclasses
2
+ import os
2
3
  import sys
3
4
  from contextlib import contextmanager
4
5
  from dataclasses import dataclass
@@ -23,8 +24,8 @@ import click
23
24
  import pluggy
24
25
  import tomli_w
25
26
 
26
- from robotcode.core.utils.contextlib import chdir
27
27
  from robotcode.core.utils.dataclasses import as_dict, as_json
28
+ from robotcode.core.utils.path import same_file
28
29
 
29
30
  __all__ = [
30
31
  "Application",
@@ -298,8 +299,24 @@ class Application:
298
299
 
299
300
  @contextmanager
300
301
  def chdir(self, path: Union[str, Path, None]) -> Iterator[Optional[Path]]:
301
- with chdir(path, self.verbose) as result:
302
- yield result
302
+ old_dir: Optional[Path] = Path.cwd()
303
+
304
+ if path is None or (old_dir and same_file(path, old_dir)):
305
+ self.verbose(f"no need to change directory to {path}")
306
+ old_dir = None
307
+ else:
308
+ if path:
309
+ self.verbose(f"Changing directory to {path}")
310
+
311
+ os.chdir(path)
312
+
313
+ try:
314
+ yield old_dir
315
+ finally:
316
+ if old_dir is not None:
317
+ self.verbose(f"Changing directory back to {old_dir}")
318
+
319
+ os.chdir(old_dir)
303
320
 
304
321
  @contextmanager
305
322
  def save_syspath(self) -> Iterator[Literal[None]]:
@@ -0,0 +1 @@
1
+ __version__ = "0.100.2"
@@ -1 +0,0 @@
1
- __version__ = "0.100.0"