Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
if: runner.os == 'Windows'
run: git config --global core.longpaths true
- name: test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
mkdir -p ~/.ssh
tox -e ${{ matrix.tox_env }} -v
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

source_suffix = '.rst'
master_doc = 'index'
project = u'travis2docker'
project = 'travis2docker'
year = '2016'
author = u'Vauxoo'
author = 'Vauxoo'
copyright = '{0}, {1}'.format(year, author)
version = release = u'7.0.5'
version = release = '7.0.5'

pygments_style = 'trac'
templates_path = ['.']
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Usage

To use travis2docker in a project::

import travis2docker
import travis2docker
2 changes: 1 addition & 1 deletion src/travis2docker/git_run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=useless-object-inheritance,except-pass
# ruff: disable[useless-object-inheritance, try-except-pass]

import contextlib
import logging
Expand Down
18 changes: 11 additions & 7 deletions src/travis2docker/travis2docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pylint: disable=useless-object-inheritance,consider-using-with
# pylint: disable=consider-using-with
# ruff: disable[useless-object-inheritance]
import json
import logging
import pathlib
Expand Down Expand Up @@ -54,8 +55,8 @@ def get_vscode_version():
lines = subprocess.check_output([code_bin, "--version"]).decode("UTF-8").splitlines()
if len(lines) >= 2 and lines[1].strip():
return "commit:%s" % lines[1].strip()
except (subprocess.CalledProcessError, OSError):
pass
except (subprocess.CalledProcessError, OSError) as e:
_logger.debug("Failed to get VS Code version: %s", e)
return "latest"

def __init__(
Expand Down Expand Up @@ -104,7 +105,10 @@ def __init__(
templates_path = templates_dir
self.copy_paths = copy_paths
self.os_kwargs = os_kwargs
self.jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_path))
self.jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(templates_path),
autoescape=jinja2.select_autoescape(['html', 'xml', 'json'])
)
self.image = image
if work_path is None:
self.work_path = pathlib.Path(gettempdir()) / pathlib.Path(__file__).stem
Expand Down Expand Up @@ -155,7 +159,7 @@ def compute_devcontainer(self):
"""Generate a .devcontainer.json so VS Code offers reopening the generated
image as a Development Container"""
name = self.os_kwargs.get("repo_project") or self.variables_sh_data.get("main_app", "odoo")
devcontainer_content = self.jinja_env.get_template("devcontainer.json").render(
devcontainer_content = self.jinja_env.get_template("devcontainer.json.jinja").render(
image=self.new_image, name=name, **self.os_kwargs
)
(self.curr_work_path / ".devcontainer.json").write_text(devcontainer_content)
Expand All @@ -169,8 +173,8 @@ def copy_path(self, path):
if src.is_dir():
try:
shutil.copytree(src, dest_path)
except shutil.Error: # ruff: ignore[except-pass]
pass # There are permissions errors to copy
except shutil.Error as e:
_logger.debug("Failed to copy directory %s to %s: %s", src, dest_path, e)
elif src.is_file():
shutil.copy(src, dest_path)
else:
Expand Down
Loading