Skip to content

Commit

Permalink
Merge branch 'hotfix/2.2.1'
Browse files Browse the repository at this point in the history
* hotfix/2.2.1:
  Version 2.2.1
  Fix #11 where dir keyword can be a relative project to source-dir (#20)
  Fixup a1fef0a (#16) when link already exists
  Fix code coverage upload to codecov (#19)
  Fix concat with method rather than string (#18)
  Avoid error when a key is not present in config (#17)
  Create relative symlinks rather than absolute (#16)
  • Loading branch information
wdeconinck committed Jan 27, 2025
2 parents 54c2787 + dd8ff33 commit 12df1c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ on:
workflow_dispatch: ~

env:
PYTHON_VERSION: 3.9
PYTHON_VERSION: "3.10"

jobs:

quality:
name: Code QA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: pip install black flake8 isort
- run: black --version
- run: isort --check .
Expand All @@ -39,10 +39,10 @@ jobs:
os: [ubuntu-latest, macos-latest]
needs: quality
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: pip install .
Expand All @@ -54,11 +54,15 @@ jobs:
- name: Run tests
run: pytest
- name: Generate Coverage
if: matrix.os == 'ubuntu-latest'
run: |
pip install pytest-cov
python -m pytest --cov=./ --cov-report=xml
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v2
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
verbose : true
token: ${{ secrets.CODECOV_UPLOAD_TOKEN }}

2 changes: 1 addition & 1 deletion ecbundle/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
from ecbundle.project import * # noqa
from ecbundle.util import * # noqa

__version__ = "2.2.0"
__version__ = "2.2.1"
4 changes: 3 additions & 1 deletion ecbundle/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from .option import Option
from .parse import parse_yaml_file, splitted, to_yaml_str
from .project import Project
from .util import fullpath, symlink_force
from .util import fullpath, mkdir_p, symlink_force

__all__ = ["Bundle", "BundleCreator"]

Expand Down Expand Up @@ -175,6 +175,8 @@ def create(self):
header(" " + bundle.file())

src_dir = self.src_dir()
mkdir_p(src_dir)

bundle_yml_file = src_dir + "/bundle.yml"

if self.bundle_needs_updating():
Expand Down
5 changes: 3 additions & 2 deletions ecbundle/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, **kwargs):
colors.enable()

def get(self, key, default=None):
return self.config[key] if self.config[key] is not None else default
return self.config.get(key, default)

def dryrun(self):
if self.get("dryrun"):
Expand Down Expand Up @@ -316,7 +316,7 @@ def download_projects(packages, download_dir):

def download_data(data_packages, download_dir):
for data in data_packages:
header("Downloading data " + data.name)
header("Downloading data " + data.name())
filename = path.basename(data.url())
do_download = True
if path.exists(download_dir + "/" + filename):
Expand Down Expand Up @@ -350,6 +350,7 @@ def download_data(data_packages, download_dir):
for project in bundle.projects():
if project.dir() and (
os.path.exists(project.dir())
or os.path.exists(self.src_dir() + "/" + project.dir())
or project.dir() in [p.name for p in git_projects]
or os.path.dirname(project.dir()) in [p.name for p in git_projects]
or project.dir() in [p.name() for p in symlink_projects]
Expand Down
7 changes: 5 additions & 2 deletions ecbundle/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@ def symlink_force(target, link_name):
import errno
import os

# prefer relative symlink rather than absolute
rel_target = os.path.relpath(target, os.path.dirname(link_name))

try:
os.symlink(target, link_name)
os.symlink(rel_target, link_name)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST:
os.remove(link_name)
os.symlink(target, link_name)
os.symlink(rel_target, link_name)
else:
raise exc

Expand Down

0 comments on commit 12df1c1

Please sign in to comment.