Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3751609
D3565.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3565.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 10:57 (20 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250180
Default Alt Text
D3565.diff (2 KB)
Attached To
Mode
D3565: Update adding a try-catch for the config.yml file
Attached
Detach File
Event Timeline
Log In to Comment