mirror of
https://github.com/dhall-lang/dhall-kubernetes.git
synced 2024-09-10 23:15:30 +03:00
Remove dead code (#118)
These scripts are obsolete and have been replaced by Nix code in `./nix/nixpkgs.nix`
This commit is contained in:
parent
9badc02688
commit
4a34acd613
@ -1,73 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Build YAML files from the example Dhall sources.
|
||||
#
|
||||
# An optional second argument determines the directory to write the YAML
|
||||
# files to. Defaults to the exmaples directory.
|
||||
#
|
||||
# Also checks that the generated files do not differ from what is
|
||||
# checked into source control. We list all generated files that differ
|
||||
# and exit with status code 1 if the list is non-empty.
|
||||
|
||||
import os
|
||||
from subprocess import run, DEVNULL
|
||||
import sys
|
||||
|
||||
examples_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'examples'))
|
||||
examples = [
|
||||
'deploymentSimple',
|
||||
'deployment',
|
||||
'ingress',
|
||||
'service'
|
||||
]
|
||||
|
||||
TERM_FAIL = '\033[91m'
|
||||
TERM_CLEAR = '\033[0m'
|
||||
|
||||
|
||||
def check_clean(path_1, path_2):
|
||||
if path_1 == path_2:
|
||||
cmd = ['git', 'diff', '--exit-code', '--', path_1]
|
||||
else:
|
||||
cmd = ['diff', '--unified', '--', path_1, path_2]
|
||||
|
||||
result = run(cmd, check=False, stdout=DEVNULL)
|
||||
if result.returncode == 0:
|
||||
return True
|
||||
elif result.returncode == 1:
|
||||
return False
|
||||
else:
|
||||
# Raises a `CalledProcessError`
|
||||
result.check_returncode()
|
||||
|
||||
|
||||
def build_yaml (example, out_dir):
|
||||
source = os.path.join(examples_dir, example + '.dhall')
|
||||
print('Building {}'.format(source))
|
||||
target = os.path.join(out_dir, example + '.yaml')
|
||||
expected = os.path.join(examples_dir, 'out', example + '.yaml')
|
||||
cmd = 'dhall-to-yaml --omitEmpty <<< "./{source}" >{target}'.format(source=source, target=target)
|
||||
run(cmd, shell=True, executable='bash', check=True)
|
||||
return check_clean(expected, target)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) >= 2:
|
||||
out_dir = sys.argv[1]
|
||||
else:
|
||||
out_dir = os.path.join(examples_dir, 'out')
|
||||
|
||||
clean_failures = []
|
||||
for example in examples:
|
||||
is_clean = build_yaml(example, out_dir)
|
||||
if is_clean == False:
|
||||
clean_failures.append(example + '.yaml')
|
||||
|
||||
if len(clean_failures) > 0:
|
||||
print(TERM_FAIL + 'Clean check failed. The following files differ' + TERM_CLEAR)
|
||||
for failure in clean_failures:
|
||||
print(' ' + failure)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
output=README.md
|
||||
else
|
||||
output="$1"
|
||||
fi
|
||||
|
||||
LC_ALL=en_US.UTF-8 dhall text <<< './docs/README.md.dhall' > $output
|
@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Typecheck and resolve all Dhall files in the ./default directory.
|
||||
#
|
||||
# Exit with 1 if at least one file fails to check.
|
||||
#
|
||||
# Some files are ingnored because they have existing errors.
|
||||
|
||||
import sys
|
||||
from glob import glob
|
||||
from subprocess import run, DEVNULL, PIPE
|
||||
|
||||
# We skip tests for the following set of files
|
||||
ignored_failures = {
|
||||
}
|
||||
|
||||
default_files = glob('./defaults/*.dhall')
|
||||
failure_files = set()
|
||||
for default_file in default_files:
|
||||
if default_file in ignored_failures:
|
||||
print('Skipping {}'.format(default_file))
|
||||
continue
|
||||
print('Checking {}'.format(default_file))
|
||||
cmd = 'dhall resolve <<< {file}'.format(file=default_file)
|
||||
result = run(cmd, shell=True, executable='bash', stdout=DEVNULL, stderr=PIPE)
|
||||
if result.returncode != 0:
|
||||
print(result.stderr.decode('utf-8'))
|
||||
failure_files.add(default_file)
|
||||
|
||||
if len(failure_files) > 0:
|
||||
print('The following files failed to check:')
|
||||
for failure_file in failure_files:
|
||||
print(' ' + failure_file)
|
||||
sys.exit(1)
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix-prefetch-git
|
||||
|
||||
nix-prefetch-git https://github.com/nixos/nixpkgs-channels.git --rev refs/heads/nixos-unstable > ./nix/nixpkgs.json
|
Loading…
Reference in New Issue
Block a user