Skip to content

Commit 0f7ec28

Browse files
author
Continuous integration
committed
Upgrade to 2.9.0.567
1 parent 53fafaf commit 0f7ec28

17 files changed

Lines changed: 169 additions & 61 deletions

File tree

CONST_create_template/env.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Default values for c2cgeoportal
2-
GEOMAPFISH_VERSION=2.9.0.566
2+
GEOMAPFISH_VERSION=2.9.0.567
33
GEOMAPFISH_MAIN_VERSION=2.9
44
GEOMAPFISH_MAIN_MINOR_VERSION=2.9.0
55
COMPOSE_PROJECT_NAME=geomapfish

CONST_create_template/geoportal/webpack.apps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ for (const filename of ls(
2323
chunks: [name],
2424
vars: {
2525
entry_point: '${VISIBLE_ENTRY_POINT}',
26-
version: '2.9.0.566',
26+
version: '2.9.0.567',
2727
cache_version: '${CACHE_VERSION}',
2828
},
2929
})

CONST_create_template/tilegeneration/config.yaml.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/tilecloud-chain/master/tilecloud_chain/schema.json
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/tilecloud-chain/1.21/tilecloud_chain/schema.json
22

33
grids:
44
# grid name, I just recommends to add the min resolution because it's common to not generate all the layers at the same resolution.

build

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ from typing import TYPE_CHECKING, Any, List, Optional
1515

1616
import yaml
1717

18-
CompletedProcess = subprocess.CompletedProcess[str] if TYPE_CHECKING else subprocess.CompletedProcess
18+
CompletedProcess = (
19+
subprocess.CompletedProcess[str] if TYPE_CHECKING else subprocess.CompletedProcess
20+
)
1921

2022

2123
def run(
22-
args: argparse.Namespace, command: List[str], exit_on_error: bool = True, **kwargs: Any
24+
args: argparse.Namespace,
25+
command: List[str],
26+
exit_on_error: bool = True,
27+
**kwargs: Any,
2328
) -> Optional[CompletedProcess]:
2429
if args.verbose or args.dry_run:
2530
print(shlex.join(command))
@@ -36,14 +41,22 @@ def run(
3641

3742
def main() -> None:
3843
parser = argparse.ArgumentParser(description="Build the project")
39-
parser.add_argument("--verbose", action="store_true", help="Display the Docker build commands")
4044
parser.add_argument(
41-
"--dry-run", action="store_true", help="Display the docker build commands without executing them"
45+
"--verbose", action="store_true", help="Display the Docker build commands"
46+
)
47+
parser.add_argument(
48+
"--dry-run",
49+
action="store_true",
50+
help="Display the docker build commands without executing them",
4251
)
4352
parser.add_argument("--service", help="Build only the specified service")
4453
parser.add_argument("--env", action="store_true", help="Build only the .env file")
45-
parser.add_argument("--simple", action="store_true", help="Force simple application mode")
46-
parser.add_argument("--not-simple", action="store_true", help="Force not simple application mode")
54+
parser.add_argument(
55+
"--simple", action="store_true", help="Force simple application mode"
56+
)
57+
parser.add_argument(
58+
"--not-simple", action="store_true", help="Force not simple application mode"
59+
)
4760
parser.add_argument("--upgrade", help="Start upgrading the project to version")
4861
parser.add_argument(
4962
"--reload",
@@ -59,9 +72,12 @@ def main() -> None:
5972
help="Do not pull external or base images for faster rebuild during development.",
6073
)
6174
parser.add_argument(
62-
"--debug", help="Path to c2cgeoportal source folder to be able to debug the upgrade procedure"
75+
"--debug",
76+
help="Path to c2cgeoportal source folder to be able to debug the upgrade procedure",
77+
)
78+
parser.add_argument(
79+
"--stack-trace", action="store_true", help="Display the stack trace on error"
6380
)
64-
parser.add_argument("--stack-trace", action="store_true", help="Display the stack trace on error")
6581
parser.add_argument("env_files", nargs="*", help="The environment config")
6682
args = parser.parse_args()
6783

@@ -123,7 +139,11 @@ def main() -> None:
123139
if args.not_simple:
124140
simple = False
125141

126-
git_hash = run(args, ["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE).stdout.decode().strip()
142+
git_hash = (
143+
run(args, ["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE)
144+
.stdout.decode()
145+
.strip()
146+
)
127147

128148
dest.write(f"SIMPLE={str(simple).upper()}\n")
129149
dest.write(f"GIT_HASH={git_hash}\n")
@@ -174,7 +194,16 @@ def main() -> None:
174194
if args.reload is not None:
175195
run(args, [*docker_compose_command, "rm", "--force", "-v", "config"])
176196
for service in services:
177-
run(args, [*docker_compose_command, "up", "--detach", "--force-recreate", service])
197+
run(
198+
args,
199+
[
200+
*docker_compose_command,
201+
"up",
202+
"--detach",
203+
"--force-recreate",
204+
service,
205+
],
206+
)
178207

179208

180209
if __name__ == "__main__":

ci/docker-compose-check

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ def _main() -> None:
1111

1212
services = [
1313
s.strip()
14-
for s in subprocess.run(["docker", "compose", "ps"], check=True, stdout=subprocess.PIPE)
14+
for s in subprocess.run(
15+
["docker", "compose", "ps"], check=True, stdout=subprocess.PIPE
16+
)
1517
.stdout.decode("utf-8")
1618
.splitlines()
1719
]
18-
errors_statuses = [s for s in services if " Exit " in s and not s.endswith(" Exit 0")]
20+
errors_statuses = [
21+
s for s in services if " Exit " in s and not s.endswith(" Exit 0")
22+
]
1923
if errors_statuses:
2024
print("\n".join(errors_statuses))
2125
sys.exit(1)

custom/custom/views/cog.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
def _get_azure_container_client(container: str) -> ContainerClient:
1616
"""Get the Azure blog storage client."""
17-
if "AZURE_STORAGE_CONNECTION_STRING" in os.environ and os.environ["AZURE_STORAGE_CONNECTION_STRING"]:
17+
if (
18+
"AZURE_STORAGE_CONNECTION_STRING" in os.environ
19+
and os.environ["AZURE_STORAGE_CONNECTION_STRING"]
20+
):
1821
return BlobServiceClient.from_connection_string(
1922
os.environ["AZURE_STORAGE_CONNECTION_STRING"]
2023
).get_container_client(container=container)
2124
if "AZURE_STORAGE_BLOB_CONTAINER_URL" in os.environ:
22-
return ContainerClient.from_container_url(os.environ["AZURE_STORAGE_BLOB_CONTAINER_URL"])
25+
return ContainerClient.from_container_url(
26+
os.environ["AZURE_STORAGE_BLOB_CONTAINER_URL"]
27+
)
2328

2429
return BlobServiceClient(
2530
account_url=os.environ["AZURE_STORAGE_ACCOUNT_URL"],
@@ -54,9 +59,13 @@ def swissalti3d(request: pyramid.request.Request) -> pyramid.response.Response:
5459

5560
blob_properties = blob.get_blob_properties()
5661
_LOGGING.debug(blob_properties)
57-
request.response.headers["Content-Range"] = f"bytes {start}-{end}/{blob_properties.size}"
62+
request.response.headers["Content-Range"] = (
63+
f"bytes {start}-{end}/{blob_properties.size}"
64+
)
5865
request.response.headers["Accept-Ranges"] = "bytes"
59-
request.response.headers["Content-Type"] = blob_properties.content_settings.content_type
66+
request.response.headers["Content-Type"] = (
67+
blob_properties.content_settings.content_type
68+
)
6069

6170
blob_data = blob.download_blob(offset=start, length=end - start + 1)
6271
request.response.body = blob_data.readall()

custom/custom/views/feedback.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
description="The feedback service",
1818
path="/feedback",
1919
cors_origins=(
20-
(f"https://{os.environ['VISIBLE_WEB_HOST']}" if "VISIBLE_WEB_HOST" in os.environ else "*"),
20+
(
21+
f"https://{os.environ['VISIBLE_WEB_HOST']}"
22+
if "VISIBLE_WEB_HOST" in os.environ
23+
else "*"
24+
),
2125
*(
2226
["https://localhost:3002"]
2327
if os.environ.get("DEV", "false").lower() in ("1", "true", "yes")
@@ -62,7 +66,9 @@ def feedback_post(request: pyramid.request.Request) -> Any:
6266
request.dbsession.flush()
6367

6468
mail_list = (
65-
[request.registry.settings["admin_email"]] if "admin_email" in request.registry.settings else []
69+
[request.registry.settings["admin_email"]]
70+
if "admin_email" in request.registry.settings
71+
else []
6672
)
6773

6874
if email_optional is not None and email_optional != "":

custom/custom/views/swisscom_heatmap/entry.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
description="The swisscom-heatmap get config service",
2121
path="/swisscom-heatmap/get-config.json",
2222
cors_origins=(
23-
(f"https://{os.environ['VISIBLE_WEB_HOST']}" if "VISIBLE_WEB_HOST" in os.environ else "*"),
23+
(
24+
f"https://{os.environ['VISIBLE_WEB_HOST']}"
25+
if "VISIBLE_WEB_HOST" in os.environ
26+
else "*"
27+
),
2428
*(
2529
["https://localhost:3002"]
2630
if os.environ.get("DEV", "false").lower() in ("1", "true", "yes")
@@ -35,7 +39,11 @@
3539
description="The swisscom-heatmap dwell density service",
3640
path="/swisscom-heatmap/dwell-density.json",
3741
cors_origins=(
38-
(f"https://{os.environ['VISIBLE_WEB_HOST']}" if "VISIBLE_WEB_HOST" in os.environ else "*"),
42+
(
43+
f"https://{os.environ['VISIBLE_WEB_HOST']}"
44+
if "VISIBLE_WEB_HOST" in os.environ
45+
else "*"
46+
),
3947
*(
4048
["https://localhost:3002"]
4149
if os.environ.get("DEV", "false").lower() in ("1", "true", "yes")
@@ -50,7 +58,11 @@
5058
description="The swisscom-heatmap dwell demographics service",
5159
path="/swisscom-heatmap/dwell-demographics.json",
5260
cors_origins=(
53-
(f"https://{os.environ['VISIBLE_WEB_HOST']}" if "VISIBLE_WEB_HOST" in os.environ else "*"),
61+
(
62+
f"https://{os.environ['VISIBLE_WEB_HOST']}"
63+
if "VISIBLE_WEB_HOST" in os.environ
64+
else "*"
65+
),
5466
*(
5567
["https://localhost:3002"]
5668
if os.environ.get("DEV", "false").lower() in ("1", "true", "yes")

custom/custom/views/swisscom_heatmap/query_swisscom_heatmap_api.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
LOG = logging.getLogger(__name__)
1414

15-
CLIENT_ID = os.getenv("SWISSCOM_CLIENT_ID", "") # customer key in the Swisscom digital marketplace
16-
CLIENT_SECRET = os.getenv("SWISSCOM_CLIENT_SECRET", "") # customer secret in the Swisscom digital marketplace
15+
CLIENT_ID = os.getenv(
16+
"SWISSCOM_CLIENT_ID", ""
17+
) # customer key in the Swisscom digital marketplace
18+
CLIENT_SECRET = os.getenv(
19+
"SWISSCOM_CLIENT_SECRET", ""
20+
) # customer secret in the Swisscom digital marketplace
1721
MIN_DATE = os.getenv("MIN_DATE", "03.10.2022")
1822
MAX_DATE = os.getenv("MAX_DATE", "16.10.2022")
1923
MAX_NB_TILES_REQUEST = int(os.getenv("MAX_NB_TILES_REQUEST", "100"))
@@ -47,18 +51,24 @@ def auth(self) -> OAuth2Session:
4751
# Fetch an access token
4852
client = BackendApplicationClient(client_id=CLIENT_ID)
4953
oauth = OAuth2Session(client=client)
50-
oauth.fetch_token(token_url=TKN_URL, client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
54+
oauth.fetch_token(
55+
token_url=TKN_URL, client_id=CLIENT_ID, client_secret=CLIENT_SECRET
56+
)
5157
return oauth
5258

5359
def get_tiles_ids(self, oauth: OAuth2Session, postal_code: int) -> list[int]:
5460
# For muni/district id, see https://www.atlas.bfs.admin.ch/maps/13/fr/17804_229_228_227/27579.html
5561
# Municipalities and Districts doesn't work well probably because of the free plan
5662
# Get all the first MAX_NB_TILES_REQUEST tile ids associated with the postal code of interest
57-
muni_tiles_json = oauth.get(BASE_URL + f"/grids/postal-code-areas/{postal_code}", headers=HEADERS)
63+
muni_tiles_json = oauth.get(
64+
BASE_URL + f"/grids/postal-code-areas/{postal_code}", headers=HEADERS
65+
)
5866
self.check_api_error(muni_tiles_json)
5967
tiles = muni_tiles_json.json()["tiles"]
6068
LOG.info("Nb tiles received: %s", len(tiles))
61-
return [t["tileId"] for t in muni_tiles_json.json()["tiles"]][:MAX_NB_TILES_REQUEST]
69+
return [t["tileId"] for t in muni_tiles_json.json()["tiles"]][
70+
:MAX_NB_TILES_REQUEST
71+
]
6272

6373
def query_api_generic(
6474
self, oauth: OAuth2Session, path: str, postal_code: int, date_time: datetime
@@ -79,24 +89,32 @@ def response_to_geojson_result(self, data: dict[str, Any]) -> FeatureCollection:
7989
features.append(Feature(geometry=Point(coordinate), properties=element))
8090
return FeatureCollection(features)
8191

82-
def get_dwell_density(self, postal_code: int, date_time: datetime) -> FeatureCollection | Response:
92+
def get_dwell_density(
93+
self, postal_code: int, date_time: datetime
94+
) -> FeatureCollection | Response:
8395
self.error = None
8496
try:
8597
self.limit_query()
8698
oauth = self.auth()
87-
api_request = self.query_api_generic(oauth, "/dwell-density/hourly", postal_code, date_time)
99+
api_request = self.query_api_generic(
100+
oauth, "/dwell-density/hourly", postal_code, date_time
101+
)
88102
response = oauth.get(api_request, headers=HEADERS)
89103
self.check_api_error(response)
90104
except (ExternalAPIError, APIUsageExceededError):
91105
return self.error
92106
return self.response_to_geojson_result(response.json())
93107

94-
def get_dwell_demographics(self, postal_code: int, date_time: datetime) -> FeatureCollection | Response:
108+
def get_dwell_demographics(
109+
self, postal_code: int, date_time: datetime
110+
) -> FeatureCollection | Response:
95111
self.error = None
96112
try:
97113
self.limit_query()
98114
oauth = self.auth()
99-
api_request = self.query_api_generic(oauth, "/dwell-demographics/hourly", postal_code, date_time)
115+
api_request = self.query_api_generic(
116+
oauth, "/dwell-demographics/hourly", postal_code, date_time
117+
)
100118
response = oauth.get(api_request, headers=HEADERS)
101119
self.check_api_error(response)
102120
except (ExternalAPIError, APIUsageExceededError):

env.default

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Default values for c2cgeoportal
2-
GEOMAPFISH_VERSION=2.9.0.566
2+
GEOMAPFISH_VERSION=2.9.0.567
33
GEOMAPFISH_MAIN_VERSION=2.9
44
GEOMAPFISH_MAIN_MINOR_VERSION=2.9.0
55
COMPOSE_PROJECT_NAME=geomapfish

0 commit comments

Comments
 (0)