Page MenuHomeDevCentral

D3565.id9182.diff
No OneTemporary

D3565.id9182.diff

diff --git a/src/upsection.py b/src/upsection.py
--- a/src/upsection.py
+++ b/src/upsection.py
@@ -29,19 +29,16 @@
with open(PACKAGE_TEMPLATE) as fd:
package_template = json.load(fd)
- package = {
- **package_template,
- **get_package_config()
- }
+ package = {**package_template, **get_package_config()}
return json.dumps(package, sort_keys=False, indent=4) + "\n"
def get_package_config():
- package_metadata = app['config']['package']
+ package_metadata = app["config"]["package"]
- repository = get_repository(package_metadata['repository_name'])
- del package_metadata['repository_name']
+ repository = get_repository(package_metadata["repository_name"])
+ del package_metadata["repository_name"]
return {
**package_metadata,
@@ -59,13 +56,13 @@
def get_browsers_list():
- return "\n".join(app['config']['tasks']['autoprefixer']['browsers'])
+ return "\n".join(app["config"]["tasks"]["autoprefixer"]["browsers"])
def get_repository(name):
return {
"type": "git",
- "url": "https://devcentral.nasqueron.org/source/" + name + ".git"
+ "url": "https://devcentral.nasqueron.org/source/" + name + ".git",
}
@@ -75,12 +72,19 @@
def initialize_app():
- with open('config.yml') as fd:
- config = yaml.safe_load(fd)
+ try:
+ with open("config.yml") as fd:
+ config = yaml.safe_load(fd)
+ except FileNotFoundError as e:
+ print(f"Error: {str(e)}", file=sys.stderr)
+ print(
+ "Please consult the documentation : https://agora.nasqueron.org/Upsection"
+ )
+ sys.exit(1)
return {
- 'config': config,
- 'builders': get_builders(),
+ "config": config,
+ "builders": get_builders(),
}
@@ -93,8 +97,8 @@
def build_all():
- for file_to_build, builder in app['builders'].items():
- with open(file_to_build, 'w') as fd:
+ for file_to_build, builder in app["builders"].items():
+ with open(file_to_build, "w") as fd:
fd.write(builder())
@@ -105,12 +109,12 @@
def build(file_to_build):
try:
- content = app['builders'][file_to_build]()
+ content = app["builders"][file_to_build]()
except KeyError:
print("Don't know how to generate", file_to_build, file=sys.stderr)
return
- with open(file_to_build, 'w') as fd:
+ with open(file_to_build, "w") as fd:
fd.write(content)

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 03:19 (12 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250180
Default Alt Text
D3565.id9182.diff (2 KB)

Event Timeline