Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' into flasher-tinkering
Browse files Browse the repository at this point in the history
  • Loading branch information
edjubuh committed Mar 31, 2017
2 parents 8de5051 + 527040e commit 5478afc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PROS CLI can be installed directly from source with the following prerequisites:
- PIP (default in Python 3.5)
- Setuptools (default in PYthon 3.5)

Clone this repository, then run `pip install --executable <dir>`. Pip will install all the dependencies necessary.
Clone this repository, then run `pip install -e <dir>`. Pip will install all the dependencies necessary.

## About this project
This python project contains 4 modules: proscli, prosconductor, prosconfig, and prosflasher
Expand All @@ -35,4 +35,4 @@ These files are serialized by jsonpickle.

### prosflasher
prosflasher contains the logic necessary to upload binaries to the VEX Cortex Microcontroller. In the future, we'd like
to reinclude the ability to manipulate the file system.
to reinclude the ability to manipulate the file system.
4 changes: 2 additions & 2 deletions proscli/conductor_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
def create_template(cfg, name, version, depot, location, ignore, upgrade_files):
first_run(cfg)
template = local.create_template(utils.Identifier(name, version, depot), location=location)
template.template_ignore = ignore
template.upgrade_paths = upgrade_files
template.template_ignore = list(ignore)
template.upgrade_paths = list(upgrade_files)
template.save()
click.echo(jsonpickle.encode(template))
click.echo('Created template at {}'.format(template.save_file))
Expand Down
18 changes: 10 additions & 8 deletions prosconductor/providers/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ def create_project(identifier, dest, pros_cli=None):
copytree(config.directory, dest)
for root, dirs, files in os.walk(dest):
for d in dirs:
d = os.path.relpath(os.path.join(root, d), config.directory)
if any([fnmatch.fnmatch(d, p) for p in config.template_ignore]):
verbose('Removing {}'.format(d))
os.rmdir(os.path.join(root, d))
for f in files:
f = os.path.relpath(os.path.join(root, f), config.directory)
if any([fnmatch.fnmatch(f, p) for p in config.template_ignore]):
verbose('Removing {}'.format(f))
os.remove(os.path.join(root, f))
Expand All @@ -144,27 +146,27 @@ def upgrade_project(identifier, dest, pros_cli=None):
config = TemplateConfig(file=filename)
for root, dirs, files in os.walk(config.directory):
for d in dirs:
f = os.path.relpath(os.path.join(root, d), config.directory)
if any([fnmatch.fnmatch(d, p) for p in config.upgrade_paths]):
verbose('Upgrading {}'.format(d))
relpath = os.path.relpath(os.path.join(root, d), config.directory)
shutil.copytree(os.path.join(config.directory, relpath), os.path.join(proj_config.directory, relpath))
shutil.copytree(os.path.join(config.directory, f), os.path.join(proj_config.directory, f))
for f in files:
f = os.path.relpath(os.path.join(root, f), config.directory)
if any([fnmatch.fnmatch(f, p) for p in config.upgrade_paths]):
verbose('Upgrading {}'.format(f))
relpath = os.path.relpath(os.path.join(root, f), config.directory)
shutil.copyfile(os.path.join(config.directory, relpath), os.path.join(proj_config.directory, relpath))
shutil.copyfile(os.path.join(config.directory, f), os.path.join(proj_config.directory, f))
for root, dirs, files in os.walk(proj_config.directory):
for d in dirs:
d = os.path.relpath(os.path.join(root, d), proj_config.directory)
if any([fnmatch.fnmatch(d, p) for p in config.remove_paths]):
verbose('Removing {}'.format(d))
relpath = os.path.relpath(os.path.join(root, d), proj_config.directory)
shutil.rmtree(os.path.join(proj_config.directory, relpath))
shutil.rmtree(os.path.join(proj_config.directory, d))

for f in files:
f = os.path.relpath(os.path.join(root, f), proj_config.directory)
if any([fnmatch.fnmatch(f, p) for p in config.remove_paths]):
verbose('Removing {}'.format(f))
relpath = os.path.relpath(os.path.join(root, f), proj_config.directory)
os.remove(os.path.join(proj_config.directory, relpath))
os.remove(os.path.join(proj_config.directory, f))
proj_config.kernel = config.identifier.version
proj_config.save()

Expand Down

0 comments on commit 5478afc

Please sign in to comment.