Skip to content

Commit

Permalink
xuananh: them config de debug va them method mapping cac path trong t…
Browse files Browse the repository at this point in the history
…erminal voi project genetica-user-portal

xuananh: chinh lai config mapping path

xuananh: them config de chay tren local

.

xuananh: add command git
  • Loading branch information
PhungXuanAnh committed Oct 28, 2023
1 parent 2ec63cc commit 8747c0b
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ ChangeLog
.direnv
.envrc
.venv
.vscode/

guake/data/gschemas.compiled
.pytest_cache/
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.0
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
}
}
]
}
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ all: clean dev style checks dists test docs

dev: clean-ln-venv ensure-pip pipenv-install-dev requirements ln-venv setup-githook \
prepare-install install-dev-locale

clean-venv:
rm -rf .venv

dev-without-ln: clean-venv ensure-pip pipenv-install-dev requirements setup-githook \
prepare-install install-dev-locale

dev-actions: ensure-pip-system pipenv-install-dev requirements setup-githook prepare-install

ensure-pip:
Expand Down Expand Up @@ -479,3 +486,31 @@ styles: style
uninstall: uninstall-system
upgrade: update
wheel: wheels

# =============================================== local ==========================

local-run: # this command run with logging INFO
.venv/bin/python guake/main.py --no-startup-script

local-run-logging-DEBUG:
.venv/bin/python guake/main.py --no-startup-script --verbose

local-debug:
.venv/bin/python -m debugpy --listen 5678 guake/main.py --no-startup-script

local-install-packages:
sudo apt install -y build-essential libdbus-glib-1-dev libgirepository1.0-dev \
pkg-config libcairo2-dev gcc python3-dev \
gettext

local-requirements:
.venv/bin/pip install -r requirements-local.txt

local-prepare-environment: local-install-packages local-requirements setup-githook prepare-install install-dev-locale

local-git-add-remote:
git remote add upstream https://github.com/Guake/guake.git

local-git-sync-remote:
git fetch upstream
git merge upstream/master
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- [1. run on local](#1-run-on-local)
- [1.1. prepare environment](#11-prepare-environment)
- [1.2. debug](#12-debug)

# 1. run on local

## 1.1. prepare environment

```shell
pyenv local 3.9.0
venv-create

make local-prepare-environment
make local-run
```

## 1.2. debug

1. run guake with debugpy

```shell
make dev-debug
```

2. run debug mode vscode
3. set breakpoints
4. reduce guake windows size, because when debug, guake terminal will stay in screen
5. do something in guake terminale
14 changes: 13 additions & 1 deletion guake/terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,18 @@ def get_current_directory(self):
directory = cwd
return directory

def mapping_file_path(self, current_path) -> Path:
cwd = self.get_current_directory()
mapping = {
"/code": cwd,
"/usr/local": cwd + "/.venv"
}
for key, value in mapping.items():
if key in current_path:
new_path = current_path.replace(key, value)
return new_path
return current_path

def is_file_on_local_server(self, text) -> Tuple[Optional[Path], Optional[int], Optional[int]]:
"""Test if the provided text matches a file on local server
Expand Down Expand Up @@ -310,7 +322,7 @@ def find_lineno(text, pt, lineno, py_func):
if line.startswith(f"def {py_func}"):
return i + 1
break

text = self.mapping_file_path(text)
pt = Path(text)
log.debug("checking file existance: %r", pt)
try:
Expand Down
7 changes: 5 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ astroid
autopep8
black==21.8b0
colorlog
dephell
dataclasses
fiximports>=0.1.18
flake8
flakehell
mock>=2.0.0
pathlib2
pep8
pew
Expand All @@ -29,9 +31,10 @@ pytest
pytest-cov
pytest-mock
reno[sphinx]>=2.8.0
scandir ; python_version < '3.5'
scandir ; python_version > '3.5'
sphinx-rtd-theme
sphinxcontrib-programoutput
toml
twine
typed-ast
yapf
6 changes: 6 additions & 0 deletions requirements-local.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-r requirements-dev.txt
dbus-python
vext
vext.gi
gobject
PyGObject
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
# `Pipfile.lock` and then regenerate `requirements*.txt`.
################################################################################

importlib_metadata; python_version < '3.8'
typing ; python_version < '3.5'
pbr
typing ; python_version > '3.5'
wheel

0 comments on commit 8747c0b

Please sign in to comment.