Skip to content

Commit

Permalink
idanmz-python3.9
Browse files Browse the repository at this point in the history
PSUtil ==> 5.6.6 to 5.6.7 due to
odoo/odoo#62919

Windows requirements only:
pywin32 224 does not exist, bumping to 225 didnt work, had to take latest 301
mhammond/pywin32#1470

pypiwin32 (220 does not exist) ==> 223
  • Loading branch information
idanwork committed Jul 19, 2021
1 parent e53b702 commit 7e6b977
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 50 deletions.
4 changes: 2 additions & 2 deletions aYaml/augmentedYaml.py
Expand Up @@ -324,7 +324,7 @@ def writeAsYaml(pyObj, out_stream=None, indentor=None, sort=False, alias_indicat
out_stream.write("~")
elif isinstance(pyObj, (list, tuple)):
if not pyObj:
out_stream.write("~")
out_stream.write("[]")
else:
indentor.push('l')
for item in pyObj:
Expand Down Expand Up @@ -355,7 +355,7 @@ def writeAsYaml(pyObj, out_stream=None, indentor=None, sort=False, alias_indicat
indentor.lineSepAndIndent(out_stream)
writeAsYaml(item, out_stream, indentor, sort, alias_indicator)
indentor.write_extra_chars(out_stream, ":")
if isScalar(pyObj[item]):
if isScalar(pyObj[item]) or not getattr(pyObj[item], "value", None): # value is either a scalar or empty list/map
indentor.write_extra_chars(out_stream, " ")
indentor += 1
writeAsYaml(pyObj[item], out_stream, indentor, sort, alias_indicator)
Expand Down
2 changes: 1 addition & 1 deletion configVar/configVarOne.py
Expand Up @@ -220,7 +220,7 @@ def extend(self, values):
if isinstance(values, (str, int, float, type(None))):
# so str will not be treated as a list of characters
self.append(values)
elif isinstance(values, collections.Sequence):
elif isinstance(values, collections.abc.Sequence):
for val in values:
self.extend(val) # flatten nested lists
elif isinstance(values, os.PathLike):
Expand Down
4 changes: 2 additions & 2 deletions defaults/main.yaml
Expand Up @@ -3,8 +3,8 @@
__INSTL_VERSION__:
- 2 # major version e.g. python-batch
- 2 # new major feature e.g. new command
- 0 # new minor feature e.g. new option to command, new python batch class
- 0 # bug fix
- 1 # new minor feature e.g. new option to command, new python batch class
- 1 # bug fix
__INSTL_VERSION_STR_SHORT__: $(__INSTL_VERSION__[0]).$(__INSTL_VERSION__[1]).$(__INSTL_VERSION__[2]).$(__INSTL_VERSION__[3])

# __INSTL_VERSION_STR_SHORT__ will be defined at run time by InstlInstanceBase.get_version_str
Expand Down
2 changes: 1 addition & 1 deletion instl.spec
Expand Up @@ -75,7 +75,7 @@ exe = EXE(pyz,
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
a.datas,:
strip=None,
upx=False,
name='instl')
Expand Down
1 change: 1 addition & 0 deletions pybatch/baseClasses.py
Expand Up @@ -62,6 +62,7 @@ class SkipActionException(Exception):
'suspend': 0,
'skip_chmod': False, # when set to True, all file/dir permission code will be bypassed
'skip_chown': False, # when set to True, all file/dir ownership code will be bypassed
'output_script': None,
}

@classmethod
Expand Down
13 changes: 9 additions & 4 deletions pybatch/copyBatchCommands.py
Expand Up @@ -3,6 +3,7 @@
from collections import defaultdict
from pathlib import Path
from typing import List
import utils
# ToDo: add unwtar ?


Expand Down Expand Up @@ -569,10 +570,14 @@ def __call__(self, *args, **kwargs) -> None:
PythonBatchCommandBase.__call__(self, *args, **kwargs)
resolved_src: Path = utils.ExpandAndResolvePath(self.src)
resolved_dst: Path = utils.ExpandAndResolvePath(self.dst)
with MakeDir(resolved_dst.parent, report_own_progress=False) as md:
md()
self.top_destination_does_not_exist = False
self.copy_file_to_file(resolved_src, resolved_dst)
if self.output_script and sys.platform == 'darwin':
utils.write_shell_command(f" cp \"{resolved_src}\" \"{resolved_dst}\" \n", self.output_script)
else:

with MakeDir(resolved_dst.parent, report_own_progress=False) as md:
md()
self.top_destination_does_not_exist = False
self.copy_file_to_file(resolved_src, resolved_dst)


class MoveFileToFile(CopyFileToFile):
Expand Down
2 changes: 1 addition & 1 deletion pyinstl/cmdOptions.py
Expand Up @@ -33,7 +33,7 @@ def __set__(self, instance, value):
if self.set_value is not None:
config_vars[self.var_name] = self.set_value
else:
if isinstance(value, collections.Sequence):
if isinstance(value, collections.abc.Sequence):
config_vars[self.var_name] = value
else:
config_vars[self.var_name] = str(value)
Expand Down
32 changes: 25 additions & 7 deletions pyinstl/instlAdmin.py
Expand Up @@ -82,7 +82,7 @@ def do_command(self):
do_command_func()

def get_revision_range(self):
revision_range_re = re.compile("""
revision_range_re = re.compile(r"""
(?P<min_rev>\d+)
(:
(?P<max_rev>\d+)
Expand Down Expand Up @@ -329,7 +329,7 @@ def prepare_conditions_for_wtar(self):
else:
self.compiled_wtar_by_file_size_exclude_regex = re.compile(".+")

self.already_wtarred_regex = re.compile("wtar(\.\w\w)?$")
self.already_wtarred_regex = re.compile(r"wtar(\.\w\w)?$")

def should_wtar(self, dir_item: Path):
_should_wtar = False
Expand Down Expand Up @@ -531,16 +531,26 @@ def verify_index_to_repo(self, problem_messages_by_iid=None):
Assuming the index and info-map have already been read
check the expect files from the index appear in the info-map
"""

no_target_folder_ok = config_vars.get("NO_TARGET_FOLDER_OK", []).list()
common_name_ok = config_vars.get("COMMON_NAME_OK", []).list()
no_files_or_folders_ok = config_vars.get("NO_FILES_OR_FOLDERS_OK", []).list()

all_iids = sorted(self.items_table.get_all_iids())
self.total_self_progress += len(all_iids)
self.items_table.change_status_of_all_iids(1)

if problem_messages_by_iid is None:
problem_messages_by_iid = defaultdict(list)

names_to_iids = defaultdict(list)
for iid in all_iids:
self.progress("checking sources for", iid)

name = self.items_table.get_details_for_active_iids("name", unique_values=True, limit_to_iids=[iid])
if name:
names_to_iids[name[0]].append(iid)

# check sources
source_and_tag_list = self.items_table.get_details_and_tag_for_active_iids("install_sources", unique_values=True, limit_to_iids=(iid,))

Expand All @@ -549,18 +559,26 @@ def verify_index_to_repo(self, problem_messages_by_iid=None):
num_files_for_source = self.info_map_table.mark_required_for_source(source_path, source_type)
if num_files_for_source == 0:
case_insensitive_items = self.info_map_table.get_any_item_recursive(source_path, case_sensitive=False)
err_message = f"""source, '{source_path}' required by {iid}, does not have any files or folders"""
if case_insensitive_items:
err_message += f"""\nthere are some files/folders with similar name but different case:\n{[s.path for s in case_insensitive_items]}"""
problem_messages_by_iid[iid].append(err_message)
if iid not in no_files_or_folders_ok:
err_message = f"""source, '{source_path}' required by {iid}, does not have any files or folders"""
if case_insensitive_items:
err_message += f"""\nthere are some files/folders with similar name but different case:\n{[s.path for s in case_insensitive_items]}"""
problem_messages_by_iid[iid].append(err_message)

# check targets
if len(source_and_tag_list) > 0:
target_folders = set(self.items_table.get_resolved_details_value_for_active_iid(iid, "install_folders", unique_values=True))
if len(target_folders) == 0:
if len(target_folders) == 0 and iid not in no_target_folder_ok:
err_message = f"iid {iid}, does not have target folder"
problem_messages_by_iid[iid].append(err_message)

for name, iids in names_to_iids.items():
if len(iids) > 1:
err_message = f"name '{name}', is common to {len(iids)} iids: {iids}"
for iid in iids:
if iid not in common_name_ok:
problem_messages_by_iid[iid].append(err_message)

self.progress("checking for cyclic dependencies")
self.info_map_table.mark_required_completion()
self.find_cycles()
Expand Down

0 comments on commit 7e6b977

Please sign in to comment.