sinol-make 1.6.0.dev1__tar.gz → 1.6.0.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. {sinol_make-1.6.0.dev1/src/sinol_make.egg-info → sinol_make-1.6.0.dev2}/PKG-INFO +1 -1
  2. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/__init__.py +1 -1
  3. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/export/__init__.py +15 -2
  4. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/cache.py +6 -7
  5. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/compile.py +12 -6
  6. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/cache_structs.py +11 -1
  7. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2/src/sinol_make.egg-info}/PKG-INFO +1 -1
  8. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/LICENSE +0 -0
  9. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/README.md +0 -0
  10. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/pyproject.toml +0 -0
  11. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/setup.cfg +0 -0
  12. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/doc/__init__.py +0 -0
  13. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/gen/__init__.py +0 -0
  14. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/ingen/__init__.py +0 -0
  15. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/ingen/ingen_util.py +0 -0
  16. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/init/__init__.py +0 -0
  17. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/inwer/__init__.py +0 -0
  18. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/inwer/inwer_util.py +0 -0
  19. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/outgen/__init__.py +0 -0
  20. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/outgen/outgen_util.py +0 -0
  21. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/run/__init__.py +0 -0
  22. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/commands/verify/__init__.py +0 -0
  23. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/contest_types/__init__.py +0 -0
  24. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/contest_types/default.py +0 -0
  25. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/contest_types/icpc.py +0 -0
  26. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/contest_types/oi.py +0 -0
  27. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/__init__.py +0 -0
  28. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/compiler.py +0 -0
  29. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/package_util.py +0 -0
  30. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/parsers.py +0 -0
  31. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/paths.py +0 -0
  32. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/helpers/printer.py +0 -0
  33. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/interfaces/BaseCommand.py +0 -0
  34. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/interfaces/Errors.py +0 -0
  35. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/interfaces/__init__.py +0 -0
  36. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/oiejq/__init__.py +0 -0
  37. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/oiejq/perf_test.py +0 -0
  38. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/__init__.py +0 -0
  39. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/compiler_structs.py +0 -0
  40. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/gen_structs.py +0 -0
  41. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/inwer_structs.py +0 -0
  42. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/run_structs.py +0 -0
  43. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/structs/status_structs.py +0 -0
  44. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make/util.py +0 -0
  45. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make.egg-info/SOURCES.txt +0 -0
  46. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make.egg-info/dependency_links.txt +0 -0
  47. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make.egg-info/entry_points.txt +0 -0
  48. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make.egg-info/requires.txt +0 -0
  49. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/src/sinol_make.egg-info/top_level.txt +0 -0
  50. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/tests/test_multiple_arguments.py +0 -0
  51. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/tests/test_oiejq.py +0 -0
  52. {sinol_make-1.6.0.dev1 → sinol_make-1.6.0.dev2}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sinol_make
3
- Version: 1.6.0.dev1
3
+ Version: 1.6.0.dev2
4
4
  Summary: CLI tool for creating sio2 task packages
5
5
  Author: Mateusz Masiarz
6
6
  Author-email: m.masiarz@fri.edu.pl
@@ -6,7 +6,7 @@ import argcomplete
6
6
 
7
7
  from sinol_make import util, oiejq
8
8
 
9
- __version__ = "1.6.0.dev1"
9
+ __version__ = "1.6.0.dev2"
10
10
 
11
11
 
12
12
  def configure_parsers():
@@ -98,6 +98,7 @@ class Command(BaseCommand):
98
98
  Creates ocen archive for sio2.
99
99
  :param target_dir: Path to exported package.
100
100
  """
101
+ print('Generating ocen archive...')
101
102
  attachments_dir = os.path.join(target_dir, 'attachments')
102
103
  if not os.path.exists(attachments_dir):
103
104
  os.makedirs(attachments_dir)
@@ -110,12 +111,25 @@ class Command(BaseCommand):
110
111
  os.makedirs(in_dir)
111
112
  out_dir = os.path.join(ocen_dir, 'out')
112
113
  os.makedirs(out_dir)
114
+ num_tests = 0
113
115
  for ext in ['in', 'out']:
114
116
  for test in glob.glob(os.path.join(tests_dir, ext, f'{self.task_id}0*.{ext}')) + \
115
117
  glob.glob(os.path.join(tests_dir, ext, f'{self.task_id}*ocen.{ext}')):
116
118
  shutil.copy(test, os.path.join(ocen_dir, ext, os.path.basename(test)))
119
+ num_tests += 1
117
120
 
118
- shutil.make_archive(os.path.join(attachments_dir, f'{self.task_id}ocen'), 'zip', tmpdir)
121
+ if num_tests == 0:
122
+ print(util.warning('No ocen tests found.'))
123
+ else:
124
+ shutil.make_archive(os.path.join(attachments_dir, f'{self.task_id}ocen'), 'zip', tmpdir)
125
+
126
+ dlazaw_dir = os.path.join(os.getcwd(), 'dlazaw')
127
+ if os.path.exists(dlazaw_dir):
128
+ print('Archiving dlazaw directory and adding to attachments.')
129
+ os.makedirs(os.path.join(tmpdir, 'dlazaw'), exist_ok=True)
130
+ shutil.copytree(dlazaw_dir, os.path.join(tmpdir, 'dlazaw', 'dlazaw'))
131
+ shutil.make_archive(os.path.join(attachments_dir, 'dlazaw'), 'zip',
132
+ os.path.join(tmpdir, 'dlazaw'))
119
133
 
120
134
  def compile_statement(self):
121
135
  command = DocCommand()
@@ -169,7 +183,6 @@ class Command(BaseCommand):
169
183
 
170
184
  self.generate_output_files()
171
185
  if self.args.export_ocen:
172
- print('Generating ocen archive...')
173
186
  self.create_ocen(target_dir)
174
187
 
175
188
  def clear_files(self, target_dir: str):
@@ -35,7 +35,7 @@ def get_cache_file(solution_path: str) -> CacheFile:
35
35
  return CacheFile()
36
36
 
37
37
 
38
- def check_compiled(file_path: str) -> Union[str, None]:
38
+ def check_compiled(file_path: str, compilation_flags: str, sanitizers: bool) -> Union[str, None]:
39
39
  """
40
40
  Check if a file is compiled
41
41
  :param file_path: Path to the file
@@ -44,7 +44,7 @@ def check_compiled(file_path: str) -> Union[str, None]:
44
44
  md5sum = util.get_file_md5(file_path)
45
45
  try:
46
46
  info = get_cache_file(file_path)
47
- if info.md5sum == md5sum:
47
+ if info.md5sum == md5sum and info.compilation_flags == compilation_flags and info.sanitizers == sanitizers:
48
48
  exe_path = info.executable_path
49
49
  if os.path.exists(exe_path):
50
50
  return exe_path
@@ -53,19 +53,18 @@ def check_compiled(file_path: str) -> Union[str, None]:
53
53
  return None
54
54
 
55
55
 
56
- def save_compiled(file_path: str, exe_path: str, is_checker: bool = False):
56
+ def save_compiled(file_path: str, exe_path: str, compilation_flags: str, sanitizers: bool, is_checker: bool = False):
57
57
  """
58
58
  Save the compiled executable path to cache in `.cache/md5sums/<basename of file_path>`,
59
59
  which contains the md5sum of the file and the path to the executable.
60
60
  :param file_path: Path to the file
61
61
  :param exe_path: Path to the compiled executable
62
+ :param compilation_flags: Compilation flags used
63
+ :param sanitizers: Whether -fsanitize=undefined,address was used
62
64
  :param is_checker: Whether the compiled file is a checker. If True, all cached tests are removed.
63
65
  """
64
- info = CacheFile()
65
- info.executable_path = exe_path
66
- info.md5sum = util.get_file_md5(file_path)
66
+ info = CacheFile(util.get_file_md5(file_path), exe_path, compilation_flags, sanitizers)
67
67
  info.save(file_path)
68
-
69
68
  if is_checker:
70
69
  remove_results_cache()
71
70
 
@@ -37,10 +37,17 @@ def compile(program, output, compilers: Compilers = None, compile_log=None, comp
37
37
  if use_fsanitize and util.is_macos_arm():
38
38
  use_fsanitize = False
39
39
 
40
+ if compilation_flags == 'w':
41
+ compilation_flags = 'weak'
42
+ elif compilation_flags == 'o':
43
+ compilation_flags = 'oioioi'
44
+ elif compilation_flags == 'd':
45
+ compilation_flags = 'default'
46
+
40
47
  if extra_compilation_files is None:
41
48
  extra_compilation_files = []
42
49
 
43
- compiled_exe = check_compiled(program)
50
+ compiled_exe = check_compiled(program, compilation_flags, use_fsanitize)
44
51
  if compiled_exe is not None:
45
52
  if compile_log is not None:
46
53
  compile_log.write(f'Using cached executable {compiled_exe}\n')
@@ -53,12 +60,11 @@ def compile(program, output, compilers: Compilers = None, compile_log=None, comp
53
60
  shutil.copy(file, os.path.join(os.path.dirname(output), os.path.basename(file)))
54
61
 
55
62
  gcc_compilation_flags = ''
56
- if compilation_flags == 'weak' or compilation_flags == 'w':
57
- compilation_flags = 'weak'
63
+ if compilation_flags == 'weak':
58
64
  gcc_compilation_flags = '' # Disable all warnings
59
- elif compilation_flags == 'oioioi' or compilation_flags == 'o':
65
+ elif compilation_flags == 'oioioi':
60
66
  gcc_compilation_flags = ' -Wall -Wno-unused-result -Werror' # Same flags as oioioi
61
- elif compilation_flags == 'default' or compilation_flags == 'd':
67
+ elif compilation_flags == 'default':
62
68
  gcc_compilation_flags = ' -Werror -Wall -Wextra -Wshadow -Wconversion -Wno-unused-result -Wfloat-equal'
63
69
  else:
64
70
  util.exit_with_error(f'Unknown compilation flags group: {compilation_flags}')
@@ -108,7 +114,7 @@ def compile(program, output, compilers: Compilers = None, compile_log=None, comp
108
114
  if process.returncode != 0:
109
115
  raise CompilationError('Compilation failed')
110
116
  else:
111
- save_compiled(program, output, is_checker)
117
+ save_compiled(program, output, compilation_flags, use_fsanitize, is_checker)
112
118
  return True
113
119
 
114
120
 
@@ -43,20 +43,28 @@ class CacheFile:
43
43
  md5sum: str
44
44
  # Path to the executable
45
45
  executable_path: str
46
+ # Compilation flags used
47
+ compilation_flags: str
48
+ # Whether -fsanitize=undefined,address was used
49
+ sanitizers: bool
46
50
  # Test results
47
51
  tests: Dict[str, CacheTest]
48
52
 
49
- def __init__(self, md5sum="", executable_path="", tests=None):
53
+ def __init__(self, md5sum="", executable_path="", compilation_flags="default", sanitizers=False, tests=None):
50
54
  if tests is None:
51
55
  tests = {}
52
56
  self.md5sum = md5sum
53
57
  self.executable_path = executable_path
58
+ self.compilation_flags = compilation_flags
59
+ self.sanitizers = sanitizers
54
60
  self.tests = tests
55
61
 
56
62
  def to_dict(self) -> Dict:
57
63
  return {
58
64
  "md5sum": self.md5sum,
59
65
  "executable_path": self.executable_path,
66
+ "compilation_flags": self.compilation_flags,
67
+ "sanitizers": self.sanitizers,
60
68
  "tests": {k: v.to_dict() for k, v in self.tests.items()}
61
69
  }
62
70
 
@@ -65,6 +73,8 @@ class CacheFile:
65
73
  return CacheFile(
66
74
  md5sum=dict.get("md5sum", ""),
67
75
  executable_path=dict.get("executable_path", ""),
76
+ compilation_flags=dict.get("compilation_flags", "default"),
77
+ sanitizers=dict.get("sanitizers", False),
68
78
  tests={k: CacheTest(
69
79
  time_limit=v["time_limit"],
70
80
  memory_limit=v["memory_limit"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sinol_make
3
- Version: 1.6.0.dev1
3
+ Version: 1.6.0.dev2
4
4
  Summary: CLI tool for creating sio2 task packages
5
5
  Author: Mateusz Masiarz
6
6
  Author-email: m.masiarz@fri.edu.pl
File without changes