From 149562b984377ffca8d6e39de4efb43411e1d605 Mon Sep 17 00:00:00 2001 From: Aniket-Rai1 <53720401+Aniket-Rai1@users.noreply.github.com> Date: Thu, 28 Sep 2023 20:11:46 -0400 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20Added=20port=20to=20project.pro?= =?UTF-8?q?s:=20(#292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Uninstall charset_normalizer * added port option * Update pros/cli/conductor.py Co-authored-by: BennyBot <48661356+BennyBot@users.noreply.github.com> * Update .github/workflows/main.yml Co-authored-by: BennyBot <48661356+BennyBot@users.noreply.github.com> * Update pros/cli/upload.py * 🐛 Fix fat binary error in CI (#293) * Update main.yml * Try new version of python * Maybe this will work? * We try again * Make the uninstall work * Work --------- Co-authored-by: Kunwar Sahni * Uninstall charset_normalizer * added port option * Update pros/cli/conductor.py Co-authored-by: BennyBot <48661356+BennyBot@users.noreply.github.com> * Update .github/workflows/main.yml Co-authored-by: BennyBot <48661356+BennyBot@users.noreply.github.com> * Update pros/cli/upload.py --------- Co-authored-by: ayushuk Co-authored-by: Ayush Shukla <71904196+ayushuk@users.noreply.github.com> Co-authored-by: BennyBot <48661356+BennyBot@users.noreply.github.com> Co-authored-by: Kunwar Sahni Co-authored-by: Benjamin Davis --- pros/cli/upload.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pros/cli/upload.py b/pros/cli/upload.py index 63f132a4..545609a4 100644 --- a/pros/cli/upload.py +++ b/pros/cli/upload.py @@ -70,6 +70,8 @@ def upload(path: Optional[str], project: Optional[c.Project], port: str, **kwarg # apply upload_options as a template options = dict(**project.upload_options) + if 'port' in options and port is None: + port = options.get('port', None) if 'slot' in options and kwargs.get('slot', None) is None: kwargs.pop('slot') elif kwargs.get('slot', None) is None: From 4daf4977ccc9904f0d64f958b5e0110818e63c98 Mon Sep 17 00:00:00 2001 From: Mayank Patibandla <34776435+mayankpatibandla@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:43:34 -0400 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8Adding=20and=20removing=20depots?= =?UTF-8?q?=20(#299)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add depot * remove depot & query depot * fix typo * ui.echo instead of print * add docstrings * Better formatting & confirmation messages * Documentation for adding/removing depots * Better formatting * Removed newlines * Updated docs --- pros/cli/conductor.py | 44 ++++++++++++++++++++++++++++++++++++ pros/conductor/conductor.py | 11 +++++++++ pros/conductor/depots.md | 45 +++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 pros/conductor/depots.md diff --git a/pros/cli/conductor.py b/pros/cli/conductor.py index ee6048d9..79e098f1 100644 --- a/pros/cli/conductor.py +++ b/pros/cli/conductor.py @@ -7,6 +7,7 @@ from pros.conductor.templates import ExternalTemplate from pros.ga.analytics import analytics + @pros_root def conductor_cli(): pass @@ -323,3 +324,46 @@ def info_project(project: c.Project, ls_upgrades): template["upgrades"] = sorted({t.version for t in templates}, key=lambda v: semver.Version(v), reverse=True) ui.finalize('project-report', report) + +@conductor.command('add-depot') +@click.argument('name') +@click.argument('url') +@default_options +def add_depot(name: str, url: str): + """ + Add a depot + + Visit https://pros.cs.purdue.edu/v5/cli/conductor.html to learn more + """ + _conductor = c.Conductor() + _conductor.add_depot(name, url) + + ui.echo(f"Added depot {name} from {url}") + +@conductor.command('remove-depot') +@click.argument('name') +@default_options +def remove_depot(name: str): + """ + Remove a depot + + Visit https://pros.cs.purdue.edu/v5/cli/conductor.html to learn more + """ + _conductor = c.Conductor() + _conductor.remove_depot(name) + + ui.echo(f"Removed depot {name}") + +@conductor.command('query-depots') +@click.option('--url', is_flag=True) +@default_options +def query_depots(url: bool): + """ + Gets all the stored depots + + Visit https://pros.cs.purdue.edu/v5/cli/conductor.html to learn more + """ + _conductor = c.Conductor() + ui.echo(f"Available Depots{' (Add --url for the url)' if not url else ''}:\n") + ui.echo('\n'.join(_conductor.query_depots(url))+"\n") + \ No newline at end of file diff --git a/pros/conductor/conductor.py b/pros/conductor/conductor.py index 7592c659..c7021f01 100644 --- a/pros/conductor/conductor.py +++ b/pros/conductor/conductor.py @@ -320,3 +320,14 @@ def new_project(self, path: str, no_default_libs: bool = False, **kwargs) -> Pro except Exception as e: logger(__name__).exception(e) return proj + + def add_depot(self, name: str, url: str): + self.depots[name] = HttpDepot(name, url) + self.save() + + def remove_depot(self, name: str): + del self.depots[name] + self.save() + + def query_depots(self, url: bool): + return [name + ((' -- ' + depot.location) if url else '') for name, depot in self.depots.items()] diff --git a/pros/conductor/depots.md b/pros/conductor/depots.md new file mode 100644 index 00000000..33a92336 --- /dev/null +++ b/pros/conductor/depots.md @@ -0,0 +1,45 @@ +# Adding Depots + +`pros conduct add-depot ` + +Example: +```bash +$ pros conduct add-depot test "https://pros.cs.purdue.edu/v5/_static/beta/testing-mainline.json" +> Added depot test from https://pros.cs.purdue.edu/v5/_static/beta/testing-mainline.json +``` + +# Removing Depots + +`pros conduct remove-depot ` + +Example: +```bash +$ pros conduct remove-depot test +> Removed depot test +``` + + +# Query Depots + +`pros conduct query-depots --url` +`pros conduct query-depots` + +Examples: +```bash +$ pros conduct query-depots --url +> Available Depots: +> +> kernel-beta-mainline -- https://raw.githubusercontent.com/purduesigbots/pros-mainline/master/beta/kernel-beta-mainline.json +> pros-mainline -- https://purduesigbots.github.io/pros-mainline/pros-mainline.json +> test -- https://pros.cs.purdue.edu/v5/_static/beta/testing-mainline.json +> +``` +```bash +$ pros conduct query-depots +> Available Depots (Add --url for the url): +> +> kernel-beta-mainline +> pros-mainline +> test +> +``` From 40dedd96c244d8b02527ddd9beda853dc7d509e2 Mon Sep 17 00:00:00 2001 From: 12944qwerty Date: Thu, 5 Oct 2023 11:02:30 -0400 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20Deprecate=20pros=20upgdrade?= =?UTF-8?q?=20(#297)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pros/cli/misc_commands.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pros/cli/misc_commands.py b/pros/cli/misc_commands.py index 56c63217..8566456a 100644 --- a/pros/cli/misc_commands.py +++ b/pros/cli/misc_commands.py @@ -17,6 +17,11 @@ def upgrade(force_check, no_install): """ Check for updates to the PROS CLI """ + with ui.Notification(): + ui.echo('The "pros upgrade" command is currently non-functioning. Did you mean to run "pros c upgrade"?', color='yellow') + + return # Dead code below + analytics.send("upgrade") from pros.upgrade import UpgradeManager manager = UpgradeManager()