()
| 110 | |
| 111 | |
| 112 | def main(): |
| 113 | root = logging.getLogger() |
| 114 | root.addHandler(logging.NullHandler()) |
| 115 | |
| 116 | options = parse_options() |
| 117 | |
| 118 | # Processing of 'continue' option. |
| 119 | # If 'continue' is set maps generation is continued from the last build |
| 120 | # that is found automatically. |
| 121 | build_name = None |
| 122 | continue_ = getattr(options, "continue") |
| 123 | if continue_ is None or continue_: |
| 124 | d = find_last_build_dir(continue_) |
| 125 | if d is None: |
| 126 | raise ContinueError( |
| 127 | "The build cannot continue: the last build directory was not found." |
| 128 | ) |
| 129 | build_name = d |
| 130 | |
| 131 | countries_line = "" |
| 132 | without_countries_line = "" |
| 133 | if "COUNTRIES" in os.environ: |
| 134 | countries_line = os.environ["COUNTRIES"] |
| 135 | if options.countries: |
| 136 | countries_line = options.countries |
| 137 | else: |
| 138 | countries_line = "*" |
| 139 | |
| 140 | if options.without_countries: |
| 141 | without_countries_line = options.without_countries |
| 142 | |
| 143 | all_countries = get_all_countries_list(PathProvider.borders_path()) |
| 144 | |
| 145 | def end_star_compare(prefix, full): |
| 146 | return full.startswith(prefix) |
| 147 | |
| 148 | def compare(a, b): |
| 149 | return a == b |
| 150 | |
| 151 | def get_countries_set_from_line(line): |
| 152 | countries = [] |
| 153 | used_countries = set() |
| 154 | countries_list = [] |
| 155 | if os.path.isfile(line): |
| 156 | with open(line) as f: |
| 157 | countries_list = [x.strip() for x in f] |
| 158 | elif line: |
| 159 | countries_list = [x.strip() for x in line.replace(";", ",").split(",")] |
| 160 | |
| 161 | for country_item in countries_list: |
| 162 | cmp = compare |
| 163 | _raw_country = country_item[:] |
| 164 | if _raw_country and _raw_country[-1] == "*": |
| 165 | _raw_country = _raw_country.replace("*", "") |
| 166 | cmp = end_star_compare |
| 167 | |
| 168 | for country in all_countries: |
| 169 | if cmp(_raw_country, country): |
no test coverage detected