Page MenuHomeDevCentral

No OneTemporary

diff --git a/src/upsection.py b/src/upsection.py
index 17e9a7c..60b0eb2 100755
--- a/src/upsection.py
+++ b/src/upsection.py
@@ -1,119 +1,119 @@
#!/usr/bin/env python3
import json
import sys
import yaml
# -------------------------------------------------------------
# Available builders configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PACKAGE_TEMPLATE = "/usr/local/share/upsection/package-template.json"
def get_builders():
return {
".browserslistrc": build_browserslistrc,
"package.json": build_package,
}
# -------------------------------------------------------------
# Build package.json
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def build_package():
with open(PACKAGE_TEMPLATE) as fd:
package_template = json.load(fd)
package = {
**package_template,
- **get_package_config()
+ **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,
"repository": repository,
}
# -------------------------------------------------------------
# Build .browserslistrc
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def build_browserslistrc():
return "# Browsers that we support\n" + get_browsers_list() + "\n"
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",
}
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def initialize_app():
- with open('config.yml') as fd:
+ with open("config.yml") as fd:
config = yaml.safe_load(fd)
return {
- 'config': config,
- 'builders': get_builders(),
+ "config": config,
+ "builders": get_builders(),
}
def run(args):
if len(args) == 1:
build_all()
return
build_some(args[1:])
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())
def build_some(files_to_build):
for file_to_build in files_to_build:
build(file_to_build)
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)
if __name__ == "__main__":
app = initialize_app()
run(sys.argv)

File Metadata

Mime Type
text/x-diff
Expires
Thu, Sep 18, 07:44 (9 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2990198
Default Alt Text
(3 KB)

Event Timeline