Skip to content

Commit 9859b62

Browse files
authored
fix(cli): fix renku rerun/update with unicode paths (#1963)
1 parent 4f52369 commit 9859b62

File tree

5 files changed

+67
-51
lines changed

5 files changed

+67
-51
lines changed

Pipfile.lock

Lines changed: 45 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

renku/core/commands/cwl_runner.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import os
2121
import shutil
2222
import sys
23+
from urllib.parse import unquote
2324

2425
import click
2526

@@ -71,8 +72,8 @@ def addLocation(d):
7172

7273
def remove_prefix(location, prefix="file://"):
7374
if location.startswith(prefix):
74-
return location[len(prefix) :]
75-
return location
75+
return unquote(location[len(prefix) :])
76+
return unquote(location)
7677

7778
locations = {remove_prefix(output["location"]) for output in outputs.values()}
7879
# make sure to not move an output if it's containing directory gets moved

renku/core/management/repository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from renku.core.models.refs import LinkReference
4343
from renku.core.models.workflow.dependency_graph import DependencyGraph
4444
from renku.core.utils.migrate import MigrationType
45+
from renku.core.utils.scm import git_unicode_unescape
4546

4647
from .git import GitCore
4748

@@ -319,7 +320,8 @@ def process_commit(self, commit=None, path=None):
319320

320321
if not path:
321322
# search for activities a file could have been a part of
322-
activities = self.activities_for_paths(commit.stats.files.keys(), file_commit=commit, revision="HEAD")
323+
paths = [git_unicode_unescape(p) for p in commit.stats.files.keys()]
324+
activities = self.activities_for_paths(paths, file_commit=commit, revision="HEAD")
323325
if len(activities) > 1:
324326
raise errors.CommitProcessingError(
325327
"Found multiple activities that produced the same entity at commit {}".format(commit)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def run(self):
161161
"click>=7.0,<=7.1.2",
162162
"cryptography>=3.4.1,<3.5",
163163
"cwlgen>=0.4.0,<=0.4.2",
164-
"cwltool>=3.0.20210124104916,<3.1",
164+
"cwltool>=3.0.20210319143721,<3.1",
165165
"environ_config>=18.2.0,<=20.1.0",
166166
"filelock>=3.0.0,<=3.0.12",
167167
"gitpython==3.1.12",

tests/cli/test_rerun.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@
3030
from renku.cli import cli
3131

3232

33-
def test_simple_rerun(runner, project, run, no_lfs_warning):
33+
@pytest.mark.parametrize(
34+
"source,selected",
35+
[
36+
("coffee-orders-☕-by-locationtest.csv", "😍works.txt"),
37+
("source.txt", "selected.txt"),
38+
("test-愛", "成功"),
39+
("그래프", "성공"),
40+
("يحاول", "نجاح.txt"),
41+
("график.txt", "успех.txt"),
42+
("𒁃.c", "𒁏.txt"),
43+
],
44+
)
45+
def test_simple_rerun(runner, project, run, no_lfs_warning, source, selected):
3446
"""Test simple file recreation."""
3547
greetings = {"hello", "hola", "ahoj"}
3648

3749
cwd = Path(project)
38-
source = cwd / "source.txt"
39-
selected = cwd / "selected.txt"
50+
source = cwd / source
51+
selected = cwd / selected
4052

4153
repo = git.Repo(project)
4254

0 commit comments

Comments
 (0)