-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: introduce bundled/libs/tool folders and move python source …
…to src folder this is to prepare the splitting of one big python package to several smaller packages, i.e. to install the robotcode.debugger standalone without other dependencies
- Loading branch information
Showing
131 changed files
with
310 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,4 +290,6 @@ report.html | |
.robotcode_cache/ | ||
|
||
# ruff | ||
.ruff_cache/ | ||
.ruff_cache/ | ||
|
||
bundled/libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,6 @@ doc | |
|
||
.pre-commit-config.yaml | ||
.devcontainer | ||
|
||
src | ||
bundled/libs/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import pathlib | ||
import site | ||
import sys | ||
|
||
|
||
def update_sys_path(path_to_add: str, strategy: str) -> None: | ||
if path_to_add not in sys.path and pathlib.Path(path_to_add).is_dir(): | ||
if any(p for p in pathlib.Path(path_to_add).iterdir() if p.suffix == ".pth"): | ||
site.addsitedir(path_to_add) | ||
return | ||
|
||
if strategy == "useBundled": | ||
sys.path.insert(0, path_to_add) | ||
elif strategy == "fromEnvironment": | ||
sys.path.append(path_to_add) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Ensure that we can import LSP libraries, and other bundled libraries. | ||
update_sys_path( | ||
os.fspath(pathlib.Path(__file__).parent.parent / "libs"), | ||
os.getenv("LS_IMPORT_STRATEGY", "useBundled"), | ||
) | ||
|
||
# Run the language server. | ||
from robotcode.language_server.robotframework.utils.version import get_robot_version | ||
|
||
print(get_robot_version() >= (4, 0)) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import pathlib | ||
import site | ||
import sys | ||
|
||
|
||
def update_sys_path(path_to_add: str, strategy: str) -> None: | ||
if path_to_add not in sys.path and pathlib.Path(path_to_add).is_dir(): | ||
if any(p for p in pathlib.Path(path_to_add).iterdir() if p.suffix == ".pth"): | ||
site.addsitedir(path_to_add) | ||
return | ||
|
||
if strategy == "useBundled": | ||
sys.path.insert(0, path_to_add) | ||
elif strategy == "fromEnvironment": | ||
sys.path.append(path_to_add) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Ensure that we can import LSP libraries, and other bundled libraries. | ||
update_sys_path( | ||
os.fspath(pathlib.Path(__file__).parent.parent.parent.parent / "libs"), | ||
os.getenv("LS_IMPORT_STRATEGY", "useBundled"), | ||
) | ||
|
||
from robotcode.debugger.launcher.cli import main | ||
|
||
main() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import pathlib | ||
import site | ||
import sys | ||
|
||
|
||
def update_sys_path(path_to_add: str, strategy: str) -> None: | ||
if path_to_add not in sys.path and pathlib.Path(path_to_add).is_dir(): | ||
if any(p for p in pathlib.Path(path_to_add).iterdir() if p.suffix == ".pth"): | ||
site.addsitedir(path_to_add) | ||
return | ||
|
||
if strategy == "useBundled": | ||
sys.path.insert(0, path_to_add) | ||
elif strategy == "fromEnvironment": | ||
sys.path.append(path_to_add) | ||
|
||
|
||
if __name__ == "__main__": | ||
# Ensure that we can import LSP libraries, and other bundled libraries. | ||
update_sys_path( | ||
os.fspath(pathlib.Path(__file__).parent.parent.parent / "libs"), | ||
os.getenv("LS_IMPORT_STRATEGY", "useBundled"), | ||
) | ||
|
||
# Run the language server. | ||
from robotcode.language_server.cli import main | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import shutil | ||
from pathlib import Path | ||
from subprocess import run | ||
|
||
|
||
def main() -> None: | ||
dist_path = Path("./dist") | ||
if not dist_path.exists(): | ||
dist_path.mkdir() | ||
|
||
shutil.rmtree("./bundled/libs", ignore_errors=True) | ||
|
||
run( | ||
"pip install -U -t ./bundled/libs --no-cache-dir --implementation py --no-deps -e .", shell=True | ||
).check_returncode() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.