Browse Source

Added use of make file in export

master
Jake Howard 5 years ago
parent
commit
fbe5ee4423
  1. 26
      project/export/cli.py
  2. 2
      project/utils/repos.py

26
project/export/cli.py

@ -1,13 +1,16 @@
import click
from project.export import exports
from project.utils import repos
from project.utils import repos, shell
DEFAULT = 'all'
@click.command('export')
@click.argument('sections', nargs=-1)
@click.argument('sections', nargs=-1, default=DEFAULT)
def cli(sections):
functions = [f for k, f in exports.__dict__.items() if is_function(f)]
if sections: # If they don't want to export everything
if sections != DEFAULT: # If they don't want to export everything
temp_functions = functions
functions = []
for func in temp_functions:
@ -18,13 +21,28 @@ def cli(sections):
try:
repos.go_to_data() # Reset data directory
func()
if func.__name__ in sections:
sections.remove(func)
except Exception as e:
errors.append(e)
if sections:
if DEFAULT in sections:
repos.go_to_data()
out, error = shell.call("make export")
if error:
errors.append(error)
else:
for item in sections:
repos.go_to_data()
out, error = shell.call("make " + item)
if error:
errors.append(error)
break
if errors:
print("Errors:")
for error in errors:
print(error)
return 1
return 0

2
project/utils/repos.py

@ -58,7 +58,7 @@ def has_data(data):
def go_to_data(subdir=''):
path = os.path.join(constants.PUBLIC_DATA_DIR, subdir)
path = os.path.join(constants.ALL_DATA_DIR, subdir)
os.chdir(path)
return path

Loading…
Cancel
Save