Skip to content

Commit

Permalink
Make format_version a str
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Feb 1, 2024
1 parent 5654e6c commit 2182344
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions reprounzip/reprounzip/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ def update_parameters():
except OSError:
pass
else:
ver = packaging.version.parse(parameters.get('version', '1.0'))
ver = parameters.get('version', '1.0')
if (
packaging.version.parse('1.1')
<= ver
<= packaging.version.parse(ver)
< packaging.version.parse('3.0')
):
return
Expand Down
8 changes: 6 additions & 2 deletions reprounzip/reprounzip/unpackers/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,13 @@ def generate(target, configfile, database, all_forks=False, graph_format='dot',
inputs_outputs = config.inputs_outputs
inputs_outputs_map = dict((f.path, n)
for n, f in config.inputs_outputs.items())
has_thread_flag = config.format_version >= packaging.version.parse('0.7')
has_thread_flag = (
packaging.version.parse(config.format_version)
>= packaging.version.parse('0.7')
)
has_exit_timestamp = (
config.format_version >= packaging.version.parse('1.1')
packaging.version.parse(config.format_version)
>= packaging.version.parse('1.1')
)

runs, files, edges = read_events(database, all_forks,
Expand Down
5 changes: 4 additions & 1 deletion reprounzip/reprounzip/unpackers/provviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def generate(target, configfile, database):

config = load_config(configfile, canonical=False)

has_thread_flag = config.format_version >= packaging.version.parse('0.7')
has_thread_flag = (
packaging.version.parse(config.format_version)
>= packaging.version.parse('0.7')
)

assert database.is_file()
conn = sqlite3.connect(str(database)) # connect() only accepts str
Expand Down
4 changes: 2 additions & 2 deletions reprozip-core/reprozip_core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,15 @@ def load_config(filename, canonical):
# Turn bytes values into Python 3 str values
_bytes_to_surrogates(config)

ver = packaging.version.parse(config['version'])
ver = config['version']

keys_ = set(config)
if 'version' not in keys_:
raise InvalidConfig("Missing version")
# Accepts versions from 0.2 to 1.1 inclusive
elif not (
packaging.version.parse('0.2')
<= ver
<= packaging.version.parse(ver)
< packaging.version.parse('1.2')
):
pkgname = (__package__ or __name__).split('.', 1)[0]
Expand Down

0 comments on commit 2182344

Please sign in to comment.