Added use of make file in export
This commit is contained in:
parent
19f8115c4a
commit
fbe5ee4423
2 changed files with 23 additions and 5 deletions
|
@ -1,13 +1,16 @@
|
||||||
import click
|
import click
|
||||||
from project.export import exports
|
from project.export import exports
|
||||||
from project.utils import repos
|
from project.utils import repos, shell
|
||||||
|
|
||||||
|
|
||||||
|
DEFAULT = 'all'
|
||||||
|
|
||||||
|
|
||||||
@click.command('export')
|
@click.command('export')
|
||||||
@click.argument('sections', nargs=-1)
|
@click.argument('sections', nargs=-1, default=DEFAULT)
|
||||||
def cli(sections):
|
def cli(sections):
|
||||||
functions = [f for k, f in exports.__dict__.items() if is_function(f)]
|
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
|
temp_functions = functions
|
||||||
functions = []
|
functions = []
|
||||||
for func in temp_functions:
|
for func in temp_functions:
|
||||||
|
@ -18,13 +21,28 @@ def cli(sections):
|
||||||
try:
|
try:
|
||||||
repos.go_to_data() # Reset data directory
|
repos.go_to_data() # Reset data directory
|
||||||
func()
|
func()
|
||||||
|
if func.__name__ in sections:
|
||||||
|
sections.remove(func)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append(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:
|
if errors:
|
||||||
print("Errors:")
|
print("Errors:")
|
||||||
for error in errors:
|
for error in errors:
|
||||||
print(error)
|
print(error)
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ def has_data(data):
|
||||||
|
|
||||||
|
|
||||||
def go_to_data(subdir=''):
|
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)
|
os.chdir(path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
Reference in a new issue