mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Merge remote-tracking branch 'khopa/develop' into develop
This commit is contained in:
commit
969e4a2d65
@ -13,6 +13,7 @@ Saves from 2.5 are not compatible with 3.0.
|
|||||||
* **[Modding]** Campaigns now choose locations for factories to spawn.
|
* **[Modding]** Campaigns now choose locations for factories to spawn.
|
||||||
* **[Modding]** Can now install custom factions to <DCS saved games>/Liberation/Factions instead of the Liberation install directory.
|
* **[Modding]** Can now install custom factions to <DCS saved games>/Liberation/Factions instead of the Liberation install directory.
|
||||||
* **[Performance Settings]** Added a settings to lower the number of smoke effects generated on frontlines. Lowered default settings for frontline smoke generators, so less smoke should be generated by default.
|
* **[Performance Settings]** Added a settings to lower the number of smoke effects generated on frontlines. Lowered default settings for frontline smoke generators, so less smoke should be generated by default.
|
||||||
|
* **[Configuration]** Liberation preferences (DCS install and save game location) are now saved to `%LOCALAPPDATA%/DCSLiberation` to prevent needing to reconfigure each new install.
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
|
|||||||
@ -117,6 +117,7 @@ from dcs.planes import (
|
|||||||
Yak_40,
|
Yak_40,
|
||||||
plane_map,
|
plane_map,
|
||||||
I_16,
|
I_16,
|
||||||
|
Tu_142,
|
||||||
)
|
)
|
||||||
from dcs.ships import (
|
from dcs.ships import (
|
||||||
Boat_Armed_Hi_speed,
|
Boat_Armed_Hi_speed,
|
||||||
@ -456,6 +457,7 @@ PRICES = {
|
|||||||
Tu_160: 50,
|
Tu_160: 50,
|
||||||
Tu_22M3: 40,
|
Tu_22M3: 40,
|
||||||
Tu_95MS: 35,
|
Tu_95MS: 35,
|
||||||
|
Tu_142: 35,
|
||||||
# special
|
# special
|
||||||
IL_76MD: 30,
|
IL_76MD: 30,
|
||||||
An_26B: 25,
|
An_26B: 25,
|
||||||
|
|||||||
@ -154,6 +154,8 @@ class Faction:
|
|||||||
faction.awacs = load_all_aircraft(json.get("awacs", []))
|
faction.awacs = load_all_aircraft(json.get("awacs", []))
|
||||||
faction.tankers = load_all_aircraft(json.get("tankers", []))
|
faction.tankers = load_all_aircraft(json.get("tankers", []))
|
||||||
|
|
||||||
|
faction.aircrafts = list(set(faction.aircrafts + faction.awacs))
|
||||||
|
|
||||||
faction.frontline_units = load_all_vehicles(json.get("frontline_units", []))
|
faction.frontline_units = load_all_vehicles(json.get("frontline_units", []))
|
||||||
faction.artillery_units = load_all_vehicles(json.get("artillery_units", []))
|
faction.artillery_units = load_all_vehicles(json.get("artillery_units", []))
|
||||||
faction.infantry_units = load_all_vehicles(json.get("infantry_units", []))
|
faction.infantry_units = load_all_vehicles(json.get("infantry_units", []))
|
||||||
|
|||||||
@ -282,6 +282,11 @@ class Game:
|
|||||||
)
|
)
|
||||||
self.turn += 1
|
self.turn += 1
|
||||||
|
|
||||||
|
# Need to recompute before transfers and deliveries to account for captures.
|
||||||
|
# This happens in in initialize_turn as well, because cheating doesn't advance a
|
||||||
|
# turn but can capture bases so we need to recompute there as well.
|
||||||
|
self.compute_transit_networks()
|
||||||
|
|
||||||
# Must happen *before* unit deliveries are handled, or else new units will spawn
|
# Must happen *before* unit deliveries are handled, or else new units will spawn
|
||||||
# one hop ahead. ControlPoint.process_turn handles unit deliveries.
|
# one hop ahead. ControlPoint.process_turn handles unit deliveries.
|
||||||
self.transfers.perform_transfers()
|
self.transfers.perform_transfers()
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
import dcs
|
import dcs
|
||||||
@ -10,7 +12,10 @@ global __dcs_saved_game_directory
|
|||||||
global __dcs_installation_directory
|
global __dcs_installation_directory
|
||||||
global __last_save_file
|
global __last_save_file
|
||||||
|
|
||||||
PREFERENCES_FILE_PATH = "liberation_preferences.json"
|
|
||||||
|
USER_PATH = Path(os.environ["LOCALAPPDATA"]) / "DCSLiberation"
|
||||||
|
|
||||||
|
PREFERENCES_PATH = USER_PATH / "liberation_preferences.json"
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
@ -18,18 +23,16 @@ def init():
|
|||||||
global __dcs_installation_directory
|
global __dcs_installation_directory
|
||||||
global __last_save_file
|
global __last_save_file
|
||||||
|
|
||||||
if os.path.isfile(PREFERENCES_FILE_PATH):
|
if PREFERENCES_PATH.exists():
|
||||||
try:
|
try:
|
||||||
with (open(PREFERENCES_FILE_PATH)) as prefs:
|
logging.debug("Loading Liberation preferences from %s", PREFERENCES_PATH)
|
||||||
pref_data = json.loads(prefs.read())
|
with PREFERENCES_PATH.open() as prefs:
|
||||||
__dcs_saved_game_directory = pref_data["saved_game_dir"]
|
pref_data = json.load(prefs)
|
||||||
__dcs_installation_directory = pref_data["dcs_install_dir"]
|
__dcs_saved_game_directory = pref_data["saved_game_dir"]
|
||||||
if "last_save_file" in pref_data:
|
__dcs_installation_directory = pref_data["dcs_install_dir"]
|
||||||
__last_save_file = pref_data["last_save_file"]
|
__last_save_file = pref_data.get("last_save_file", "")
|
||||||
else:
|
|
||||||
__last_save_file = ""
|
|
||||||
is_first_start = False
|
is_first_start = False
|
||||||
except:
|
except KeyError:
|
||||||
__dcs_saved_game_directory = ""
|
__dcs_saved_game_directory = ""
|
||||||
__dcs_installation_directory = ""
|
__dcs_installation_directory = ""
|
||||||
__last_save_file = ""
|
__last_save_file = ""
|
||||||
@ -78,8 +81,9 @@ def save_config():
|
|||||||
"dcs_install_dir": __dcs_installation_directory,
|
"dcs_install_dir": __dcs_installation_directory,
|
||||||
"last_save_file": __last_save_file,
|
"last_save_file": __last_save_file,
|
||||||
}
|
}
|
||||||
with (open(PREFERENCES_FILE_PATH, "w")) as prefs:
|
PREFERENCES_PATH.parent.mkdir(exist_ok=True, parents=True)
|
||||||
prefs.write(json.dumps(pref_data))
|
with PREFERENCES_PATH.open("w") as prefs:
|
||||||
|
json.dump(pref_data, prefs, indent=" ")
|
||||||
|
|
||||||
|
|
||||||
def get_dcs_install_directory():
|
def get_dcs_install_directory():
|
||||||
|
|||||||
@ -223,6 +223,8 @@ def lint_weapon_data() -> None:
|
|||||||
def main():
|
def main():
|
||||||
logging_config.init_logging(VERSION)
|
logging_config.init_logging(VERSION)
|
||||||
|
|
||||||
|
logging.debug("Python version %s", sys.version)
|
||||||
|
|
||||||
game: Optional[Game] = None
|
game: Optional[Game] = None
|
||||||
|
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
|
|||||||
@ -27,8 +27,27 @@ from qt_ui.windows.groundobject.QGroundObjectMenu import QGroundObjectMenu
|
|||||||
|
|
||||||
LeafletLatLon = List[float]
|
LeafletLatLon = List[float]
|
||||||
|
|
||||||
|
# **EVERY PROPERTY NEEDS A NOTIFY SIGNAL**
|
||||||
|
#
|
||||||
|
# https://bugreports.qt.io/browse/PYSIDE-1426
|
||||||
|
#
|
||||||
|
# PySide2 5.15.2 released 6 days before the fix for this was merged, but presumably we
|
||||||
|
# can clean up after 5.15.3 (or a future version) is released.
|
||||||
|
#
|
||||||
|
# Until then, all properties must use a notify signal. For some reason the error doesn't
|
||||||
|
# show up when running from source, and member properties also are not sufficient.
|
||||||
|
# Failing to do this will cause every sync of the property to emit an expensive log
|
||||||
|
# message. This can prevent the UI from being responsive.
|
||||||
|
#
|
||||||
|
# A local signal (i.e. `@Property(t, notify=Signal())`) is not sufficient. The class
|
||||||
|
# needs a named signal for every property, even if it is constant.
|
||||||
|
|
||||||
|
|
||||||
class ControlPointJs(QObject):
|
class ControlPointJs(QObject):
|
||||||
|
nameChanged = Signal()
|
||||||
|
blueChanged = Signal()
|
||||||
|
positionChanged = Signal()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
control_point: ControlPoint,
|
control_point: ControlPoint,
|
||||||
@ -41,15 +60,15 @@ class ControlPointJs(QObject):
|
|||||||
self.theater = theater
|
self.theater = theater
|
||||||
self.dialog: Optional[QBaseMenu2] = None
|
self.dialog: Optional[QBaseMenu2] = None
|
||||||
|
|
||||||
@Property(str)
|
@Property(str, notify=nameChanged)
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.control_point.name
|
return self.control_point.name
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=blueChanged)
|
||||||
def blue(self) -> bool:
|
def blue(self) -> bool:
|
||||||
return self.control_point.captured
|
return self.control_point.captured
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=positionChanged)
|
||||||
def position(self) -> LeafletLatLon:
|
def position(self) -> LeafletLatLon:
|
||||||
ll = self.theater.point_to_ll(self.control_point.position)
|
ll = self.theater.point_to_ll(self.control_point.position)
|
||||||
return [ll.latitude, ll.longitude]
|
return [ll.latitude, ll.longitude]
|
||||||
@ -66,6 +85,13 @@ class ControlPointJs(QObject):
|
|||||||
|
|
||||||
|
|
||||||
class GroundObjectJs(QObject):
|
class GroundObjectJs(QObject):
|
||||||
|
nameChanged = Signal()
|
||||||
|
unitsChanged = Signal()
|
||||||
|
blueChanged = Signal()
|
||||||
|
positionChanged = Signal()
|
||||||
|
samThreatRangesChanged = Signal()
|
||||||
|
samDetectionRangesChanged = Signal()
|
||||||
|
|
||||||
def __init__(self, tgo: TheaterGroundObject, game: Game) -> None:
|
def __init__(self, tgo: TheaterGroundObject, game: Game) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.tgo = tgo
|
self.tgo = tgo
|
||||||
@ -96,7 +122,7 @@ class GroundObjectJs(QObject):
|
|||||||
def showPackageDialog(self) -> None:
|
def showPackageDialog(self) -> None:
|
||||||
Dialog.open_new_package_dialog(self.tgo)
|
Dialog.open_new_package_dialog(self.tgo)
|
||||||
|
|
||||||
@Property(str)
|
@Property(str, notify=nameChanged)
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.tgo.name
|
return self.tgo.name
|
||||||
|
|
||||||
@ -110,7 +136,7 @@ class GroundObjectJs(QObject):
|
|||||||
)
|
)
|
||||||
return f"Unit #{unit.id} - {unit_display_name}{dead_label}"
|
return f"Unit #{unit.id} - {unit_display_name}{dead_label}"
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=unitsChanged)
|
||||||
def units(self) -> List[str]:
|
def units(self) -> List[str]:
|
||||||
units = []
|
units = []
|
||||||
if self.buildings:
|
if self.buildings:
|
||||||
@ -124,16 +150,16 @@ class GroundObjectJs(QObject):
|
|||||||
units.append(self.make_unit_name(unit, dead=True))
|
units.append(self.make_unit_name(unit, dead=True))
|
||||||
return units
|
return units
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=blueChanged)
|
||||||
def blue(self) -> bool:
|
def blue(self) -> bool:
|
||||||
return self.tgo.control_point.captured
|
return self.tgo.control_point.captured
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=positionChanged)
|
||||||
def position(self) -> LeafletLatLon:
|
def position(self) -> LeafletLatLon:
|
||||||
ll = self.theater.point_to_ll(self.tgo.position)
|
ll = self.theater.point_to_ll(self.tgo.position)
|
||||||
return [ll.latitude, ll.longitude]
|
return [ll.latitude, ll.longitude]
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=samThreatRangesChanged)
|
||||||
def samThreatRanges(self) -> List[float]:
|
def samThreatRanges(self) -> List[float]:
|
||||||
if not self.tgo.might_have_aa:
|
if not self.tgo.might_have_aa:
|
||||||
return []
|
return []
|
||||||
@ -145,7 +171,7 @@ class GroundObjectJs(QObject):
|
|||||||
ranges.append(threat_range.meters)
|
ranges.append(threat_range.meters)
|
||||||
return ranges
|
return ranges
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=samDetectionRangesChanged)
|
||||||
def samDetectionRanges(self) -> List[float]:
|
def samDetectionRanges(self) -> List[float]:
|
||||||
if not self.tgo.might_have_aa:
|
if not self.tgo.might_have_aa:
|
||||||
return []
|
return []
|
||||||
@ -159,6 +185,11 @@ class GroundObjectJs(QObject):
|
|||||||
|
|
||||||
|
|
||||||
class SupplyRouteJs(QObject):
|
class SupplyRouteJs(QObject):
|
||||||
|
pointsChanged = Signal()
|
||||||
|
frontActiveChanged = Signal()
|
||||||
|
isSeaChanged = Signal()
|
||||||
|
blueChanged = Signal()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
a: ControlPoint,
|
a: ControlPoint,
|
||||||
@ -172,32 +203,34 @@ class SupplyRouteJs(QObject):
|
|||||||
self._points = points
|
self._points = points
|
||||||
self.sea_route = sea_route
|
self.sea_route = sea_route
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=pointsChanged)
|
||||||
def points(self) -> List[LeafletLatLon]:
|
def points(self) -> List[LeafletLatLon]:
|
||||||
return self._points
|
return self._points
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=frontActiveChanged)
|
||||||
def frontActive(self) -> bool:
|
def frontActive(self) -> bool:
|
||||||
if self.sea_route:
|
if self.sea_route:
|
||||||
return False
|
return False
|
||||||
return self.control_point_a.front_is_active(self.control_point_b)
|
return self.control_point_a.front_is_active(self.control_point_b)
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=isSeaChanged)
|
||||||
def isSea(self) -> bool:
|
def isSea(self) -> bool:
|
||||||
return self.sea_route
|
return self.sea_route
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=blueChanged)
|
||||||
def blue(self) -> bool:
|
def blue(self) -> bool:
|
||||||
return self.control_point_a.captured
|
return self.control_point_a.captured
|
||||||
|
|
||||||
|
|
||||||
class FrontLineJs(QObject):
|
class FrontLineJs(QObject):
|
||||||
|
extentsChanged = Signal()
|
||||||
|
|
||||||
def __init__(self, front_line: FrontLine, theater: ConflictTheater) -> None:
|
def __init__(self, front_line: FrontLine, theater: ConflictTheater) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.front_line = front_line
|
self.front_line = front_line
|
||||||
self.theater = theater
|
self.theater = theater
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=extentsChanged)
|
||||||
def extents(self) -> List[LeafletLatLon]:
|
def extents(self) -> List[LeafletLatLon]:
|
||||||
a = self.theater.point_to_ll(
|
a = self.theater.point_to_ll(
|
||||||
self.front_line.position.point_from_heading(
|
self.front_line.position.point_from_heading(
|
||||||
@ -217,6 +250,14 @@ class FrontLineJs(QObject):
|
|||||||
|
|
||||||
|
|
||||||
class WaypointJs(QObject):
|
class WaypointJs(QObject):
|
||||||
|
numberChanged = Signal()
|
||||||
|
positionChanged = Signal()
|
||||||
|
altitudeFtChanged = Signal()
|
||||||
|
altitudeReferenceChanged = Signal()
|
||||||
|
nameChanged = Signal()
|
||||||
|
timingChanged = Signal()
|
||||||
|
isDivertChanged = Signal()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
waypoint: FlightWaypoint,
|
waypoint: FlightWaypoint,
|
||||||
@ -230,28 +271,28 @@ class WaypointJs(QObject):
|
|||||||
self.flight_plan = flight_plan
|
self.flight_plan = flight_plan
|
||||||
self.theater = theater
|
self.theater = theater
|
||||||
|
|
||||||
@Property(int)
|
@Property(int, notify=numberChanged)
|
||||||
def number(self) -> int:
|
def number(self) -> int:
|
||||||
return self._number
|
return self._number
|
||||||
|
|
||||||
@Property(list)
|
@Property(list, notify=positionChanged)
|
||||||
def position(self) -> LeafletLatLon:
|
def position(self) -> LeafletLatLon:
|
||||||
ll = self.theater.point_to_ll(self.waypoint.position)
|
ll = self.theater.point_to_ll(self.waypoint.position)
|
||||||
return [ll.latitude, ll.longitude]
|
return [ll.latitude, ll.longitude]
|
||||||
|
|
||||||
@Property(int)
|
@Property(int, notify=altitudeFtChanged)
|
||||||
def altitudeFt(self) -> int:
|
def altitudeFt(self) -> int:
|
||||||
return int(self.waypoint.alt.feet)
|
return int(self.waypoint.alt.feet)
|
||||||
|
|
||||||
@Property(str)
|
@Property(str, notify=altitudeReferenceChanged)
|
||||||
def altitudeReference(self) -> str:
|
def altitudeReference(self) -> str:
|
||||||
return "AGL" if self.waypoint.alt_type == "RADIO" else "MSL"
|
return "AGL" if self.waypoint.alt_type == "RADIO" else "MSL"
|
||||||
|
|
||||||
@Property(str)
|
@Property(str, notify=nameChanged)
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
return self.waypoint.name
|
return self.waypoint.name
|
||||||
|
|
||||||
@Property(str)
|
@Property(str, notify=timingChanged)
|
||||||
def timing(self) -> str:
|
def timing(self) -> str:
|
||||||
prefix = "TOT"
|
prefix = "TOT"
|
||||||
time = self.flight_plan.tot_for_waypoint(self.waypoint)
|
time = self.flight_plan.tot_for_waypoint(self.waypoint)
|
||||||
@ -262,13 +303,15 @@ class WaypointJs(QObject):
|
|||||||
return ""
|
return ""
|
||||||
return f"{prefix} T+{timedelta(seconds=int(time.total_seconds()))}"
|
return f"{prefix} T+{timedelta(seconds=int(time.total_seconds()))}"
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=isDivertChanged)
|
||||||
def isDivert(self) -> bool:
|
def isDivert(self) -> bool:
|
||||||
return self.waypoint.waypoint_type is FlightWaypointType.DIVERT
|
return self.waypoint.waypoint_type is FlightWaypointType.DIVERT
|
||||||
|
|
||||||
|
|
||||||
class FlightJs(QObject):
|
class FlightJs(QObject):
|
||||||
flightPlanChanged = Signal()
|
flightPlanChanged = Signal()
|
||||||
|
blueChanged = Signal()
|
||||||
|
selectedChanged = Signal()
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, flight: Flight, selected: bool, theater: ConflictTheater
|
self, flight: Flight, selected: bool, theater: ConflictTheater
|
||||||
@ -298,11 +341,11 @@ class FlightJs(QObject):
|
|||||||
def flightPlan(self) -> List[WaypointJs]:
|
def flightPlan(self) -> List[WaypointJs]:
|
||||||
return self._waypoints
|
return self._waypoints
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=blueChanged)
|
||||||
def blue(self) -> bool:
|
def blue(self) -> bool:
|
||||||
return self.flight.departure.captured
|
return self.flight.departure.captured
|
||||||
|
|
||||||
@Property(bool)
|
@Property(bool, notify=selectedChanged)
|
||||||
def selected(self) -> bool:
|
def selected(self) -> bool:
|
||||||
return self._selected
|
return self._selected
|
||||||
|
|
||||||
|
|||||||
@ -52,23 +52,19 @@ class QAircraftRecruitmentMenu(QFrame, QRecruitBehaviour):
|
|||||||
row = 0
|
row = 0
|
||||||
|
|
||||||
unit_types: Set[Type[FlyingType]] = set()
|
unit_types: Set[Type[FlyingType]] = set()
|
||||||
for task in tasks:
|
for unit_type in self.game_model.game.player_faction.aircrafts:
|
||||||
units = db.find_unittype(task, self.game_model.game.player_name)
|
if not issubclass(unit_type, FlyingType):
|
||||||
if not units:
|
raise RuntimeError(f"Non-flying aircraft found in faction: {unit_type}")
|
||||||
|
if self.cp.is_carrier and unit_type not in db.CARRIER_CAPABLE:
|
||||||
continue
|
continue
|
||||||
for unit in units:
|
if self.cp.is_lha and unit_type not in db.LHA_CAPABLE:
|
||||||
if not issubclass(unit, FlyingType):
|
continue
|
||||||
continue
|
if (
|
||||||
if self.cp.is_carrier and unit not in db.CARRIER_CAPABLE:
|
self.cp.cptype in [ControlPointType.FOB, ControlPointType.FARP]
|
||||||
continue
|
and unit_type not in helicopter_map.values()
|
||||||
if self.cp.is_lha and unit not in db.LHA_CAPABLE:
|
):
|
||||||
continue
|
continue
|
||||||
if (
|
unit_types.add(unit_type)
|
||||||
self.cp.cptype in [ControlPointType.FOB, ControlPointType.FARP]
|
|
||||||
and unit not in helicopter_map.values()
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
unit_types.add(unit)
|
|
||||||
|
|
||||||
sorted_units = sorted(
|
sorted_units = sorted(
|
||||||
unit_types,
|
unit_types,
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from zipfile import *
|
THIS_DIR = Path(__file__).resolve()
|
||||||
|
SRC_DIR = THIS_DIR.parents[1]
|
||||||
|
|
||||||
|
|
||||||
IGNORED_PATHS = [
|
IGNORED_PATHS = [
|
||||||
@ -15,10 +17,8 @@ IGNORED_PATHS = [
|
|||||||
"venv",
|
"venv",
|
||||||
]
|
]
|
||||||
|
|
||||||
VERSION = input("version str:")
|
|
||||||
|
|
||||||
|
def _zip_dir(archive, path):
|
||||||
def _zip_dir(archieve, path):
|
|
||||||
for path, directories, files in os.walk(path):
|
for path, directories, files in os.walk(path):
|
||||||
is_ignored = False
|
is_ignored = False
|
||||||
for ignored_path in IGNORED_PATHS:
|
for ignored_path in IGNORED_PATHS:
|
||||||
@ -32,29 +32,16 @@ def _zip_dir(archieve, path):
|
|||||||
for file in files:
|
for file in files:
|
||||||
if file in IGNORED_PATHS:
|
if file in IGNORED_PATHS:
|
||||||
continue
|
continue
|
||||||
archieve.write(os.path.join(path, file))
|
archive.write(os.path.join(path, file))
|
||||||
|
|
||||||
|
|
||||||
def _mk_archieve():
|
def main():
|
||||||
path = os.path.join(
|
|
||||||
os.path.dirname(__file__),
|
|
||||||
os.pardir,
|
|
||||||
os.pardir,
|
|
||||||
"build",
|
|
||||||
"dcs_liberation_{}.zip".format(VERSION),
|
|
||||||
)
|
|
||||||
if os.path.exists(path):
|
|
||||||
print("version already exists")
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.rmtree("./dist")
|
shutil.rmtree("./dist")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
os.system("pyinstaller.exe --clean pyinstaller.spec")
|
os.system("pyinstaller.exe --clean pyinstaller.spec")
|
||||||
# archieve = ZipFile(path, "w")
|
|
||||||
# archieve.writestr("dcs_liberation.bat", "cd dist\\dcs_liberation\r\nliberation_main \"%UserProfile%\\Saved Games\" \"{}\"".format(VERSION))
|
|
||||||
# _zip_dir(archieve, "./dist/dcs_liberation")
|
|
||||||
|
|
||||||
|
|
||||||
_mk_archieve()
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user