maps4fs 2.9.32__py3-none-any.whl → 2.9.34__py3-none-any.whl

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.

Potentially problematic release.


This version of maps4fs might be problematic. Click here for more details.

@@ -51,11 +51,19 @@ def ensure_templates():
51
51
  If MFS_TEMPLATES_DIR is empty or doesn't exist, clone the maps4fsdata
52
52
  repository and run the preparation script to populate it.
53
53
  """
54
-
55
54
  # Check if templates directory exists and has content
56
- if os.path.exists(MFS_TEMPLATES_DIR) and os.listdir(MFS_TEMPLATES_DIR):
57
- logger.info("Templates directory already exists and contains data: %s", MFS_TEMPLATES_DIR)
58
- return
55
+ if os.path.exists(MFS_TEMPLATES_DIR): # and os.listdir(MFS_TEMPLATES_DIR):
56
+ logger.info("Templates directory already exists: %s", MFS_TEMPLATES_DIR)
57
+
58
+ files = [
59
+ entry
60
+ for entry in os.listdir(MFS_TEMPLATES_DIR)
61
+ if os.path.isfile(os.path.join(MFS_TEMPLATES_DIR, entry))
62
+ ]
63
+
64
+ if files:
65
+ logger.info("Templates directory contains files and will not be modified.")
66
+ return
59
67
 
60
68
  logger.info("Templates directory is empty or missing, preparing data...")
61
69
 
@@ -156,6 +164,27 @@ def ensure_template_subdirs() -> None:
156
164
  logger.info("Templates directory is ready at: %s", MFS_TEMPLATES_DIR)
157
165
 
158
166
 
167
+ def reload_templates() -> None:
168
+ """Reload templates by removing existing files and re-preparing them.
169
+ Does not affect nested directories containing user data.
170
+ If needed, the files should be removed manually.
171
+ """
172
+ logger.info("Reloading templates...")
173
+ # Remove files from the templates directory.
174
+ # But do not remove nested directories, because they contain user data.
175
+ # Only remove files in the top-level templates directory.
176
+ for item in os.listdir(MFS_TEMPLATES_DIR):
177
+ item_path = os.path.join(MFS_TEMPLATES_DIR, item)
178
+ if os.path.isfile(item_path):
179
+ try:
180
+ os.remove(item_path)
181
+ except Exception as e:
182
+ logger.warning("Could not remove file %s: %s", item_path, str(e))
183
+ ensure_templates()
184
+ ensure_template_subdirs()
185
+ logger.info("Templates reloaded successfully.")
186
+
187
+
159
188
  ensure_templates()
160
189
  ensure_template_subdirs()
161
190
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maps4fs
3
- Version: 2.9.32
3
+ Version: 2.9.34
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: GNU Affero General Public License v3.0
@@ -1,7 +1,7 @@
1
1
  maps4fs/__init__.py,sha256=5ixsCA5vgcIV0OrF9EJBm91Mmc_KfMiDRM-QyifMAvo,386
2
2
  maps4fs/logger.py,sha256=aZAa9glzgvH6ySVDLelSPTwHfWZtpGK5YBl-ufNUsPg,801
3
3
  maps4fs/generator/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
4
- maps4fs/generator/config.py,sha256=_s5pLpATVF-hwpcVquDUOhochD1RghPJczwyKepXtrc,7889
4
+ maps4fs/generator/config.py,sha256=gLYch5ZTmuJ4Bo9EKzwutZVpOHsTVlY90gSFLkzegmk,9035
5
5
  maps4fs/generator/game.py,sha256=bflRv0lxJ9-wkRvauh0k0RzIgF7zVWguygqQLcC7U-s,18457
6
6
  maps4fs/generator/map.py,sha256=9F3PaoK63sbhNONvHN46k62-ZFMBQy5qvu9T193gwWs,16045
7
7
  maps4fs/generator/monitor.py,sha256=Yrc7rClpmJK53SRzrOYZNBlwJmb5l6TkW-laFbyBEno,3524
@@ -24,8 +24,8 @@ maps4fs/generator/component/base/component.py,sha256=-7H3donrH19f0_rivNyI3fgLsiZ
24
24
  maps4fs/generator/component/base/component_image.py,sha256=GXFkEFARNRkWkDiGSjvU4WX6f_8s6R1t2ZYqZflv1jk,9626
25
25
  maps4fs/generator/component/base/component_mesh.py,sha256=2wGe_-wAZVRljMKzzVJ8jdzIETWg7LjxGj8A3inH5eI,25550
26
26
  maps4fs/generator/component/base/component_xml.py,sha256=MT-VhU2dEckLFxAgmxg6V3gnv11di_94Qq6atfpOLdc,5342
27
- maps4fs-2.9.32.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
28
- maps4fs-2.9.32.dist-info/METADATA,sha256=4X4Nut1e-f0FRrwMLVvJy1LZwUxhs4JH6C1KAleQ4Yk,10213
29
- maps4fs-2.9.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
- maps4fs-2.9.32.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
31
- maps4fs-2.9.32.dist-info/RECORD,,
27
+ maps4fs-2.9.34.dist-info/licenses/LICENSE.md,sha256=Ptw8AkqJ60c4tRts6yuqGP_8B0dxwOGmJsp6YJ8dKqM,34328
28
+ maps4fs-2.9.34.dist-info/METADATA,sha256=N8RjSki41ECPZSKqYO5R97NgpGKcpeonB6SyWKI_m8c,10213
29
+ maps4fs-2.9.34.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
30
+ maps4fs-2.9.34.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
31
+ maps4fs-2.9.34.dist-info/RECORD,,