igs-slm 0.2.0b0__py3-none-any.whl → 0.2.0b2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: igs-slm
3
- Version: 0.2.0b0
3
+ Version: 0.2.0b2
4
4
  Summary: IGS Site Log Manager
5
5
  Project-URL: Homepage, https://igs-slm.readthedocs.io
6
6
  Project-URL: Documentation, https://igs-slm.readthedocs.io
@@ -6,7 +6,7 @@ igs_tools/defines/__init__.py,sha256=iQyg6SLcDT1KMtK6XToUdCUqmSZnPKY1ztjdOcaKEB0
6
6
  igs_tools/defines/constellation.py,sha256=Di0QX83YqACChVrxReKeQcjsQxY5G5bdp1e5iDeefNM,560
7
7
  igs_tools/defines/data_center.py,sha256=gLoUebE90C4OeyvEqCx-1RY2C0Nq9N9rchPc7V--lqk,2895
8
8
  igs_tools/defines/rinex.py,sha256=hHJzuqO5VZbroK6wznTxX0CEGB-WZea4S4F-lpJXKYc,1824
9
- slm/__init__.py,sha256=aL26EHXkC6nfQoUquho2O1rzX3IjynyWj-ZpF78TrmY,995
9
+ slm/__init__.py,sha256=B1ZoKXsfDEPDv1GU1THyjN6A5lUc3YFIwJS9dHpP_fU,995
10
10
  slm/admin.py,sha256=01lyfEJw81hwn-5qmz3VeTc34H2OoGz_1B_3PMWZ9oA,20811
11
11
  slm/apps.py,sha256=Tf3FBaYkjH57bqdh0r0KBFitsKl3aJe_uQE9iZNmOzc,11949
12
12
  slm/authentication.py,sha256=pdckO48ApGTwbaHLJsc2IswSs8qM9W3BLVU8XkSAa4E,7141
@@ -118,7 +118,7 @@ slm/jinja2/slm/sitelog/xsd/0.5/document.xml,sha256=ocBD0sHIKamOZSz67FB9a6ENWsx-o
118
118
  slm/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  slm/management/commands/__init__.py,sha256=2rXtF09XsScbEG8zepmPga5B4XuytNKOTkNxIIdHRGI,1773
120
120
  slm/management/commands/build_index.py,sha256=Ppl-DNDI8zqr0oiJXhSp8PFVE7_Aeoi5o4ZXAHkl6_0,3358
121
- slm/management/commands/check_upgrade.py,sha256=fohkrLCNPRnOqfe2jSQS2YbP2oRVReSPLla6fQyAaw0,5748
121
+ slm/management/commands/check_upgrade.py,sha256=cDIchUBvM1Wv3iprTFYSK6qufnFhxdx835EbPUUrBRQ,5917
122
122
  slm/management/commands/generate_sinex.py,sha256=IesyiEleRltM2J4B-uK8_kk6R_5Q4ob_rEUeE5sPvGs,26485
123
123
  slm/management/commands/head_from_index.py,sha256=aUlk7YCCodw6tuZz02eOeUGTWZq7_3AnN8ANQw5_e8s,21035
124
124
  slm/management/commands/import_archive.py,sha256=LpkwY40gqtw7sD9iOqTQjLPfHdqCN0YyOlyWgEmiaf8,34730
@@ -273,7 +273,7 @@ slm/settings/internationalization.py,sha256=OfySI8I21FUY29EfTNspwfZVQeYDtRzbo-RA
273
273
  slm/settings/logging.py,sha256=hGe8K7gCUqxZFNuLnwUlNyfF0F3Sl3rFGg8DGlGp5-Y,4230
274
274
  slm/settings/rest.py,sha256=DFkT8d6yx7TfQteNnCjj7WrCD8XzVMNPm8nxj-Gb2Wo,787
275
275
  slm/settings/root.py,sha256=_xoJm99hMD4kkT_Z6tuyCz_DJTo5NcZ8OskPJGzgkeg,7634
276
- slm/settings/routines.py,sha256=tzLsfOhg7kTx7Yx8N2efSIvqDdc6MbrbSO1bQeBcaD4,1716
276
+ slm/settings/routines.py,sha256=pNtcPfMuPrISxlkIXEg7CBaNiCGJ8fglBRvnZnjhhME,1782
277
277
  slm/settings/secrets.py,sha256=4X5RJyYD0iOuaZ_YMdSvWxwVSGgWoXpzX9lgHldPZ3M,830
278
278
  slm/settings/security.py,sha256=yO8pbNCAAvVdJfT4mbtdA8KVsmWG5FvP6REUhnSm2IE,249
279
279
  slm/settings/slm.py,sha256=i1YUB88gZf7smyVVWOdhLrMiWUW40NqkLr06iYTccYE,8365
@@ -473,8 +473,8 @@ slm/templates/slm/widgets/stationlist.html,sha256=MzbGy2po3TQ6Cx12OEagwaU5dZ5IKY
473
473
  slm/templatetags/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
474
474
  slm/templatetags/jinja2.py,sha256=ye8Q5EVv1ATBCwkVi3UPrgRWj5a4VAI2s72pJnAftx4,222
475
475
  slm/templatetags/slm.py,sha256=c6BLClHz9-U7Z0xFzSMoRH1BlGsr5X0G9N688DtNCAk,14234
476
- igs_slm-0.2.0b0.dist-info/METADATA,sha256=--47TPSrIKUbJCOc29nmXt_9NEjEZ7fJYmMbS1UjGUM,7751
477
- igs_slm-0.2.0b0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
478
- igs_slm-0.2.0b0.dist-info/entry_points.txt,sha256=Oq_ZZdzACnQ8vhZJn8q6_8VuYJNLqkfCW5HvqMg6JTs,84
479
- igs_slm-0.2.0b0.dist-info/licenses/LICENSE,sha256=lrSWvh1Y0-xYCepGM5jimWArZ7iqaRvMV1UuPuq5mq8,1092
480
- igs_slm-0.2.0b0.dist-info/RECORD,,
476
+ igs_slm-0.2.0b2.dist-info/METADATA,sha256=VjzKikM7-QWUMD6LhhZQ2M31dy7PzCw4HORvYqjRnEw,7751
477
+ igs_slm-0.2.0b2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
478
+ igs_slm-0.2.0b2.dist-info/entry_points.txt,sha256=Oq_ZZdzACnQ8vhZJn8q6_8VuYJNLqkfCW5HvqMg6JTs,84
479
+ igs_slm-0.2.0b2.dist-info/licenses/LICENSE,sha256=lrSWvh1Y0-xYCepGM5jimWArZ7iqaRvMV1UuPuq5mq8,1092
480
+ igs_slm-0.2.0b2.dist-info/RECORD,,
slm/__init__.py CHANGED
@@ -15,7 +15,7 @@ r"""
15
15
 
16
16
  """
17
17
 
18
- VERSION = (0, 2, "0b0")
18
+ VERSION = (0, 2, "0b2")
19
19
 
20
20
  __title__ = "IGS/Site Log Manager"
21
21
  __version__ = ".".join(str(i) for i in VERSION)
@@ -13,7 +13,7 @@ import typing as t
13
13
 
14
14
  import typer
15
15
  from django.core.management import CommandError
16
- from django.db import connection
16
+ from django.db import ProgrammingError, connection
17
17
  from django.db.migrations.loader import MigrationLoader
18
18
  from django.utils.translation import gettext as _
19
19
  from django_typer.management import TyperCommand, command
@@ -75,6 +75,13 @@ class Command(TyperCommand):
75
75
 
76
76
  slm_version = parse_version(slm_version)
77
77
 
78
+ @property
79
+ def db_version(self) -> Version:
80
+ try:
81
+ return SLMVersion.load().version or parse("0.1.4b")
82
+ except ProgrammingError:
83
+ return parse("0.1.4b")
84
+
78
85
  def closest_waypoint_gte(self, version: Version) -> t.Optional[Version]:
79
86
  idx = bisect.bisect_left(self.VERSION_WAYPOINTS, version)
80
87
  if idx < len(self.VERSION_WAYPOINTS):
@@ -91,24 +98,23 @@ class Command(TyperCommand):
91
98
  help="Check that it is safe to run migrations from the installed version of igs-slm."
92
99
  )
93
100
  def is_safe(self):
94
- db_version: Version = SLMVersion.load().version or parse("0.1.4b")
95
- if db_version > self.slm_version:
101
+ if self.db_version > self.slm_version:
96
102
  # downgrades are possible with reversible migrations - we only
97
103
  # balk if the downgrade would travel through a migration waypoint
98
- nearest_waypoint = self.closest_waypoint_lte(db_version)
104
+ nearest_waypoint = self.closest_waypoint_lte(self.db_version)
99
105
  if nearest_waypoint and nearest_waypoint > self.slm_version:
100
106
  raise CommandError(
101
- f"Unable to downgrade from {db_version} to {self.slm_version}. "
107
+ f"Unable to downgrade from {self.db_version} to {self.slm_version}. "
102
108
  f"Traverses version waypoint: {nearest_waypoint}. "
103
109
  f"It is recommended that you restore from a database backup."
104
110
  )
105
- elif db_version < self.slm_version:
111
+ elif self.db_version < self.slm_version:
106
112
  # Upgrades must pass through all waypoints between the database code version and
107
113
  # the installed version of igs-slm
108
- nearest_waypoint = self.closest_waypoint_gte(db_version)
114
+ nearest_waypoint = self.closest_waypoint_gte(self.db_version)
109
115
  if nearest_waypoint and nearest_waypoint < self.slm_version:
110
116
  raise CommandError(
111
- f"Unable to upgrade from {db_version} to {self.slm_version}. "
117
+ f"Unable to upgrade from {self.db_version} to {self.slm_version}. "
112
118
  f"Traverses version waypoint: {nearest_waypoint}. "
113
119
  f"You must first install and upgrade SLM at the waypoint: "
114
120
  f"pip install igs-slm=={nearest_waypoint}."
@@ -120,20 +126,20 @@ class Command(TyperCommand):
120
126
  def set_db_version(
121
127
  self,
122
128
  version: Annotated[
123
- Version,
129
+ t.Optional[Version],
124
130
  typer.Option(
125
131
  help="The version string to set in the database if different than installed.",
126
132
  parser=parse_version,
127
133
  ),
128
- ],
134
+ ] = None,
129
135
  ):
130
136
  version = version or self.slm_version
131
- if version != SLMVersion.load().version:
137
+ if version != self.db_version:
132
138
  confirm = typer.confirm(
133
139
  _(
134
140
  "You are about to force the database to record the version of the igs-slm "
135
141
  f"software it is structurally synchronized to "
136
- f"({SLMVersion.load().version} -> {version}). Are you sure you want to do this?"
142
+ f"({self.db_version} -> {version}). Are you sure you want to do this?"
137
143
  )
138
144
  )
139
145
  if not confirm:
slm/settings/routines.py CHANGED
@@ -30,6 +30,7 @@ command("deploy", "check", "--deploy")
30
30
  command("deploy", "check_upgrade", "is-safe")
31
31
  command("deploy", "shellcompletion", "install", switches=["initial"])
32
32
  command("deploy", "migrate", priority=11)
33
+ command("deploy", "check_upgrade", "set-db-version", priority=15)
33
34
  command("deploy", "renderstatic", priority=20)
34
35
  command("deploy", "collectstatic", "--no-input", priority=21)
35
36
  if get_setting("COMPRESS_OFFLINE", False) and get_setting("COMPRESS_ENABLED", False):