Remove dead code (#118)

These scripts are obsolete and have been replaced by Nix code in
`./nix/nixpkgs.nix`
This commit is contained in:
Gabriel Gonzalez 2020-05-08 09:04:45 -07:00 committed by GitHub
parent 9badc02688
commit 4a34acd613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 120 deletions

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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