├── .github
├── FUNDING.yml
├── workflows
│ ├── deployment.yml
│ ├── core.yml
│ ├── projects.yml
│ └── examples.yml
└── ISSUE_TEMPLATE.md
├── platformio
├── project
│ ├── integration
│ │ ├── tpls
│ │ │ ├── clion
│ │ │ │ └── .gitignore.tpl
│ │ │ ├── qtcreator
│ │ │ │ ├── .gitignore.tpl
│ │ │ │ ├── platformio.creator.tpl
│ │ │ │ ├── platformio.includes.tpl
│ │ │ │ ├── platformio.files.tpl
│ │ │ │ ├── platformio.cflags.tpl
│ │ │ │ ├── platformio.cxxflags.tpl
│ │ │ │ ├── platformio.config.tpl
│ │ │ │ └── Makefile.tpl
│ │ │ ├── emacs
│ │ │ │ ├── .gitignore.tpl
│ │ │ │ └── .ccls.tpl
│ │ │ ├── vim
│ │ │ │ ├── .gitignore.tpl
│ │ │ │ └── .ccls.tpl
│ │ │ ├── vscode
│ │ │ │ ├── .gitignore.tpl
│ │ │ │ └── .vscode
│ │ │ │ │ └── extensions.json.tpl
│ │ │ ├── sublimetext
│ │ │ │ └── .ccls.tpl
│ │ │ ├── netbeans
│ │ │ │ └── nbproject
│ │ │ │ │ ├── private
│ │ │ │ │ ├── private.xml.tpl
│ │ │ │ │ └── launcher.properties.tpl
│ │ │ │ │ └── project.xml.tpl
│ │ │ ├── eclipse
│ │ │ │ ├── .settings
│ │ │ │ │ ├── org.eclipse.cdt.core.prefs.tpl
│ │ │ │ │ └── language.settings.xml.tpl
│ │ │ │ └── .project.tpl
│ │ │ └── visualstudio
│ │ │ │ └── platformio.vcxproj.filters.tpl
│ │ └── __init__.py
│ ├── __init__.py
│ ├── commands
│ │ └── __init__.py
│ ├── cli.py
│ └── exception.py
├── home
│ ├── __init__.py
│ └── rpc
│ │ ├── __init__.py
│ │ └── handlers
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── account.py
│ │ ├── registry.py
│ │ └── misc.py
├── run
│ ├── __init__.py
│ └── helpers.py
├── test
│ ├── __init__.py
│ ├── reports
│ │ ├── __init__.py
│ │ └── base.py
│ ├── runners
│ │ ├── __init__.py
│ │ └── readers
│ │ │ └── __init__.py
│ └── exception.py
├── account
│ ├── __init__.py
│ ├── org
│ │ ├── __init__.py
│ │ ├── commands
│ │ │ ├── __init__.py
│ │ │ ├── add.py
│ │ │ ├── remove.py
│ │ │ ├── destroy.py
│ │ │ ├── create.py
│ │ │ ├── list.py
│ │ │ └── update.py
│ │ └── cli.py
│ ├── team
│ │ ├── __init__.py
│ │ ├── commands
│ │ │ ├── __init__.py
│ │ │ ├── create.py
│ │ │ ├── remove.py
│ │ │ ├── add.py
│ │ │ ├── destroy.py
│ │ │ ├── update.py
│ │ │ └── list.py
│ │ └── cli.py
│ ├── commands
│ │ ├── __init__.py
│ │ ├── logout.py
│ │ ├── login.py
│ │ ├── forgot.py
│ │ ├── password.py
│ │ ├── token.py
│ │ ├── destroy.py
│ │ ├── register.py
│ │ └── update.py
│ └── cli.py
├── builder
│ ├── __init__.py
│ └── tools
│ │ ├── __init__.py
│ │ ├── pioasm.py
│ │ ├── piohooks.py
│ │ ├── pioproject.py
│ │ └── piotest.py
├── check
│ ├── __init__.py
│ └── tools
│ │ └── __init__.py
├── commands
│ ├── __init__.py
│ ├── device
│ │ └── __init__.py
│ └── update.py
├── debug
│ ├── __init__.py
│ ├── config
│ │ ├── __init__.py
│ │ ├── mspdebug.py
│ │ ├── qemu.py
│ │ ├── native.py
│ │ ├── generic.py
│ │ ├── renode.py
│ │ ├── jlink.py
│ │ ├── factory.py
│ │ └── blackmagic.py
│ ├── process
│ │ └── __init__.py
│ └── exception.py
├── device
│ ├── __init__.py
│ ├── list
│ │ └── __init__.py
│ ├── monitor
│ │ ├── __init__.py
│ │ └── filters
│ │ │ ├── __init__.py
│ │ │ ├── send_on_enter.py
│ │ │ ├── time.py
│ │ │ ├── hexlify.py
│ │ │ └── log2file.py
│ └── cli.py
├── package
│ ├── __init__.py
│ ├── commands
│ │ ├── __init__.py
│ │ ├── pack.py
│ │ └── unpublish.py
│ ├── manager
│ │ ├── __init__.py
│ │ └── tool.py
│ ├── manifest
│ │ └── __init__.py
│ ├── cli.py
│ ├── version.py
│ └── exception.py
├── platform
│ ├── __init__.py
│ └── exception.py
├── registry
│ ├── __init__.py
│ └── access
│ │ ├── __init__.py
│ │ ├── commands
│ │ ├── __init__.py
│ │ ├── private.py
│ │ ├── public.py
│ │ ├── revoke.py
│ │ ├── grant.py
│ │ └── list.py
│ │ ├── validate.py
│ │ └── cli.py
├── remote
│ ├── __init__.py
│ ├── ac
│ │ ├── __init__.py
│ │ ├── process.py
│ │ └── serial.py
│ ├── client
│ │ ├── __init__.py
│ │ ├── update_core.py
│ │ ├── agent_list.py
│ │ └── device_list.py
│ └── factory
│ │ ├── __init__.py
│ │ └── ssl.py
├── system
│ ├── __init__.py
│ ├── commands
│ │ └── __init__.py
│ └── cli.py
├── public.py
├── __init__.py
└── dependencies.py
├── CODE_OF_CONDUCT.md
├── tests
├── misc
│ ├── ino2cpp
│ │ ├── examples
│ │ │ ├── multifiles
│ │ │ │ ├── bar.ino
│ │ │ │ └── foo.pde
│ │ │ ├── basic
│ │ │ │ └── basic.ino
│ │ │ └── strmultilines
│ │ │ │ └── main.ino
│ │ ├── __init__.py
│ │ └── test_ino2cpp.py
│ ├── __init__.py
│ ├── test_misc.py
│ └── test_maintenance.py
├── __init__.py
├── commands
│ ├── __init__.py
│ ├── pkg
│ │ ├── __init__.py
│ │ ├── test_search.py
│ │ ├── test_exec.py
│ │ └── test_outdated.py
│ ├── test_settings.py
│ └── test_boards.py
├── package
│ └── __init__.py
└── project
│ ├── __init__.py
│ └── test_metadata.py
├── .gitignore
├── .gitmodules
├── .pylintrc
├── Makefile
├── CONTRIBUTING.md
├── scripts
├── fixsymlink.py
└── install_devplatforms.py
├── tox.ini
└── SECURITY.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: https://platformio.org/donate
2 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/clion/.gitignore.tpl:
--------------------------------------------------------------------------------
1 | .pio
2 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/.gitignore.tpl:
--------------------------------------------------------------------------------
1 | .pio
2 | .qtc_clangd
3 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.creator.tpl:
--------------------------------------------------------------------------------
1 | [General]
2 |
3 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/emacs/.gitignore.tpl:
--------------------------------------------------------------------------------
1 | .pio
2 | .clang_complete
3 | .ccls
4 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | See https://piolabs.com/legal/code-of-conduct.html
4 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/vim/.gitignore.tpl:
--------------------------------------------------------------------------------
1 | .pio
2 | .clang_complete
3 | .gcc-flags.json
4 | .ccls
5 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/examples/multifiles/bar.ino:
--------------------------------------------------------------------------------
1 | unsigned int barFunc () // my comment
2 | {
3 | return 0;
4 | }
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.includes.tpl:
--------------------------------------------------------------------------------
1 | ./
2 | % for include in filter_includes(includes):
3 | {{include}}
4 | % end
5 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.files.tpl:
--------------------------------------------------------------------------------
1 | Makefile
2 | platformio.ini
3 | .gitignore
4 | % for file in src_files:
5 | {{file}}
6 | % end
7 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/vscode/.gitignore.tpl:
--------------------------------------------------------------------------------
1 | .pio
2 | .vscode/.browse.c_cpp.db*
3 | .vscode/c_cpp_properties.json
4 | .vscode/launch.json
5 | .vscode/ipch
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.egg-info
2 | *.pyc
3 | __pycache__
4 | .tox
5 | docs/_build
6 | dist
7 | build
8 | .cache
9 | coverage.xml
10 | .coverage
11 | htmlcov
12 | .pytest_cache
13 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.cflags.tpl:
--------------------------------------------------------------------------------
1 | % from platformio.compat import shlex_join
2 | %
3 | {{shlex_join(cc_flags).replace('-mlongcalls', '-mlong-calls')}}
4 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.cxxflags.tpl:
--------------------------------------------------------------------------------
1 | % from platformio.compat import shlex_join
2 | %
3 | {{shlex_join(cxx_flags).replace('-mlongcalls', '-mlong-calls')}}
4 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/examples/multifiles/foo.pde:
--------------------------------------------------------------------------------
1 | char buf[5];
2 |
3 | void setup() {
4 | fooFunc();
5 | }
6 |
7 | void loop() {
8 |
9 | }
10 |
11 | char* fooFunc() {
12 | return buf;
13 | }
14 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "examples"]
2 | path = examples
3 | url = https://github.com/platformio/platformio-examples.git
4 | [submodule "docs"]
5 | path = docs
6 | url = https://github.com/platformio/platformio-docs.git
7 | branch = develop
8 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/platformio.config.tpl:
--------------------------------------------------------------------------------
1 | % for define in defines:
2 | % tokens = define.split("=", 1)
3 | % if len(tokens) > 1:
4 | #define {{tokens[0].strip()}} {{!tokens[1].strip()}}
5 | % else:
6 | #define {{define}}
7 | % end
8 | % end
9 |
--------------------------------------------------------------------------------
/.pylintrc:
--------------------------------------------------------------------------------
1 | [REPORTS]
2 | output-format=colorized
3 |
4 | [MESSAGES CONTROL]
5 | disable=
6 | missing-docstring,
7 | duplicate-code,
8 | invalid-name,
9 | too-few-public-methods,
10 | consider-using-f-string,
11 | cyclic-import,
12 | use-dict-literal
13 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/vim/.ccls.tpl:
--------------------------------------------------------------------------------
1 | % from platformio.compat import shlex_join
2 | %
3 | clang
4 |
5 | {{"%c"}} {{ shlex_join(cc_flags) }}
6 | {{"%cpp"}} {{ shlex_join(cxx_flags) }}
7 |
8 | % for include in filter_includes(includes):
9 | -I{{ !include }}
10 | % end
11 |
12 | % for define in defines:
13 | -D{{ !define }}
14 | % end
15 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/emacs/.ccls.tpl:
--------------------------------------------------------------------------------
1 | % from platformio.compat import shlex_join
2 | %
3 | clang
4 |
5 | {{"%c"}} {{ shlex_join(cc_flags) }}
6 | {{"%cpp"}} {{ shlex_join(cxx_flags) }}
7 |
8 | % for include in filter_includes(includes):
9 | -I{{ !include }}
10 | % end
11 |
12 | % for define in defines:
13 | -D{{ !define }}
14 | % end
15 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/sublimetext/.ccls.tpl:
--------------------------------------------------------------------------------
1 | % from platformio.compat import shlex_join
2 | %
3 | clang
4 |
5 | {{"%c"}} {{ shlex_join(cc_flags) }}
6 | {{"%cpp"}} {{ shlex_join(cxx_flags) }}
7 |
8 | % for include in filter_includes(includes):
9 | -I{{ !include }}
10 | % end
11 |
12 | % for define in defines:
13 | -D{{ !define }}
14 | % end
15 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/qtcreator/Makefile.tpl:
--------------------------------------------------------------------------------
1 | all:
2 | platformio -c qtcreator run
3 |
4 | # regenerate project files to reflect platformio.ini changes
5 | project-update:
6 | @echo "This will overwrite project metadata files. Are you sure? [y/N] " \
7 | && read ans && [ $${ans:-'N'} = 'y' ]
8 | platformio project init --ide qtcreator
9 |
10 | # forward any other target (clean, build, etc.) to pio run
11 | {{'%'}}:
12 | platformio -c qtcreator run --target $*
13 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/netbeans/nbproject/private/private.xml.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 | 0
8 | 0
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/misc/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/home/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/run/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/test/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/package/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/project/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/builder/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/check/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/debug/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/device/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/home/rpc/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/package/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/platform/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/project/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/registry/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/remote/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/remote/ac/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/system/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/commands/pkg/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/org/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/team/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/builder/tools/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/debug/config/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/debug/process/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/device/list/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/device/monitor/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/remote/client/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/remote/factory/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/test/reports/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/test/runners/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/home/rpc/handlers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/package/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/package/manager/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/package/manifest/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/project/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/project/integration/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/registry/access/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/system/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/device/monitor/filters/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/test/runners/readers/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
--------------------------------------------------------------------------------
/platformio/home/rpc/handlers/base.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | class BaseRPCHandler:
17 | factory = None
18 |
--------------------------------------------------------------------------------
/platformio/commands/device/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-import
16 | from platformio.device.monitor.filters.base import (
17 | DeviceMonitorFilterBase as DeviceMonitorFilter,
18 | )
19 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/eclipse/.settings/org.eclipse.cdt.core.prefs.tpl:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | environment/project/0.910961921/PATH/delimiter={{env_pathsep.replace(":", "\\:")}}
3 | environment/project/0.910961921/PATH/operation=replace
4 | environment/project/0.910961921/PATH/value={{env_path.replace(":", "\\:")}}${PathDelimiter}${PATH}
5 | environment/project/0.910961921/append=true
6 | environment/project/0.910961921/appendContributed=true
7 | environment/project/0.910961921.1363900502/PATH/delimiter={{env_pathsep.replace(":", "\\:")}}
8 | environment/project/0.910961921.1363900502/PATH/operation=replace
9 | environment/project/0.910961921.1363900502/PATH/value={{env_path.replace(":", "\\:")}}${PathDelimiter}${PATH}
10 | environment/project/0.910961921.1363900502/append=true
11 | environment/project/0.910961921.1363900502/appendContributed=true
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/eclipse/.project.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{project_name}}
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.core.ccnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/examples/basic/basic.ino:
--------------------------------------------------------------------------------
1 | #define SQR(a) \
2 | ( a * a )
3 |
4 | typedef struct Item item;
5 | struct Item {
6 | byte foo[50];
7 | int bar;
8 | void (*noob)(item*);
9 | };
10 |
11 | // test callback
12 | class Foo {
13 |
14 | public:
15 | Foo(void (*function)()) {
16 | #warning "Line number is 16"
17 | }
18 |
19 | bool childFunc() {
20 |
21 | }
22 |
23 | };
24 |
25 | Foo foo(&fooCallback);
26 |
27 | //
28 |
29 | template T Add(T n1, T n2) {
30 | return n1 + n2;
31 | }
32 |
33 | void setup() {
34 | struct Item item1;
35 | myFunction(&item1);
36 | }
37 |
38 | void loop() {
39 |
40 | }
41 |
42 | void myFunction(struct Item *item) {
43 |
44 | }
45 |
46 | #warning "Line number is 46"
47 |
48 | void fooCallback(){
49 |
50 | }
51 |
52 | extern "C" {
53 | void some_extern(const char *fmt, ...);
54 | };
55 |
56 | void some_extern(const char *fmt, ...) {
57 |
58 | }
59 |
60 | // юнікод
61 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | lint:
2 | pylint --rcfile=./.pylintrc ./tests
3 | pylint --rcfile=./.pylintrc ./platformio
4 |
5 | isort:
6 | isort ./platformio
7 | isort ./tests
8 |
9 | format:
10 | black ./platformio
11 | black ./tests
12 |
13 | codespell:
14 | codespell --skip "./build,./docs/_build" -L "AtLeast,TRE,ans,dout,homestate,ser"
15 |
16 | test:
17 | pytest --verbose --exitfirst -n 6 --dist=loadscope tests --ignore tests/test_examples.py
18 |
19 | before-commit: codespell isort format lint
20 |
21 | clean-docs:
22 | rm -rf docs/_build
23 |
24 | clean: clean-docs
25 | find . -name \*.pyc -delete
26 | find . -name __pycache__ -delete
27 | rm -rf .cache
28 | rm -rf build
29 | rm -rf htmlcov
30 | rm -f .coverage
31 |
32 | profile:
33 | # Usage $ > make PIOARGS="boards" profile
34 | python -m cProfile -o .tox/.tmp/cprofile.prof -m platformio ${PIOARGS}
35 | snakeviz .tox/.tmp/cprofile.prof
36 |
37 | pack:
38 | python setup.py sdist
39 |
40 | publish:
41 | python setup.py sdist upload
42 |
--------------------------------------------------------------------------------
/platformio/account/commands/logout.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("logout", short_help="Log out of PlatformIO Account")
21 | def account_logout_cmd():
22 | client = AccountClient()
23 | client.logout()
24 | click.secho("Successfully logged out!", fg="green")
25 |
--------------------------------------------------------------------------------
/platformio/remote/client/update_core.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.remote.client.async_base import AsyncClientBase
16 |
17 |
18 | class UpdateCoreClient(AsyncClientBase):
19 | def agent_pool_ready(self):
20 | d = self.agentpool.callRemote("cmd", self.agents, self.command, self.options)
21 | d.addCallback(self.cb_async_result)
22 | d.addErrback(self.cb_global_error)
23 |
--------------------------------------------------------------------------------
/tests/commands/test_settings.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio import app
16 | from platformio.commands.settings import cli
17 |
18 |
19 | def test_settings_check(clirunner, validate_cliresult):
20 | result = clirunner.invoke(cli, ["get"])
21 | validate_cliresult(result)
22 | assert result.output
23 | for item in app.DEFAULT_SETTINGS.items():
24 | assert item[0] in result.output
25 |
--------------------------------------------------------------------------------
/platformio/device/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.device.list.command import device_list_cmd
18 | from platformio.device.monitor.command import device_monitor_cmd
19 |
20 |
21 | @click.group(
22 | "device",
23 | commands=[
24 | device_list_cmd,
25 | device_monitor_cmd,
26 | ],
27 | short_help="Device manager & Serial/Socket monitor",
28 | )
29 | def cli():
30 | pass
31 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/netbeans/nbproject/project.xml.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.cnd.makeproject
4 |
5 |
6 | {{project_name}}
7 |
8 |
9 |
10 | UTF-8
11 |
12 |
13 | .
14 |
15 |
16 |
17 | Default
18 | 0
19 |
20 |
21 |
22 | false
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/platformio/debug/config/mspdebug.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 |
17 |
18 | class MspdebugDebugConfig(DebugConfigBase):
19 | DEFAULT_PORT = ":2000"
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | end
23 |
24 | define pio_reset_run_target
25 | end
26 |
27 | target remote $DEBUG_PORT
28 | monitor erase
29 | $LOAD_CMDS
30 | pio_reset_halt_target
31 | $INIT_BREAK
32 | """
33 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing
2 | ------------
3 |
4 | To get started, sign the Contributor License Agreement.
5 |
6 | 1. Fork the repository on GitHub
7 | 2. Clone repository `git clone --recursive https://github.com/YourGithubUsername/platformio-core.git`
8 | 3. Run `pip install tox`
9 | 4. Go to the root of the PlatformIO Core project where `tox.ini` is located (``cd platformio-core``) and run `tox -e py39`.
10 | You can replace `py39` with your own Python version. For example, `py311` means Python 3.11.
11 | 5. Activate current development environment:
12 |
13 | * Windows: `.tox\py39\Scripts\activate`
14 | * Bash/ZSH: `source .tox/py39/bin/activate`
15 | * Fish: `source .tox/py39/bin/activate.fish`
16 |
17 | 6. Make changes to code, documentation, etc.
18 | 7. Lint source code `make before-commit`
19 | 8. Run the tests `make test`
20 | 9. Build documentation `tox -e docs` (creates a directory _build under docs where you can find the html)
21 | 10. Commit changes to your forked repository
22 | 11. Submit a Pull Request on GitHub
23 |
--------------------------------------------------------------------------------
/platformio/debug/config/qemu.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 |
17 |
18 | class QemuDebugConfig(DebugConfigBase):
19 | DEFAULT_PORT = ":1234"
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | monitor system_reset
23 | end
24 |
25 | define pio_reset_run_target
26 | monitor system_reset
27 | end
28 |
29 | target extended-remote $DEBUG_PORT
30 | $LOAD_CMDS
31 | pio_reset_halt_target
32 | $INIT_BREAK
33 | """
34 |
--------------------------------------------------------------------------------
/platformio/debug/config/native.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.compat import IS_WINDOWS
16 | from platformio.debug.config.base import DebugConfigBase
17 |
18 |
19 | class NativeDebugConfig(DebugConfigBase):
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | end
23 |
24 | define pio_reset_run_target
25 | end
26 |
27 | define pio_restart_target
28 | end
29 |
30 | $INIT_BREAK
31 | """ + (
32 | "set startup-with-shell off" if not IS_WINDOWS else ""
33 | )
34 |
--------------------------------------------------------------------------------
/platformio/debug/config/generic.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 |
17 |
18 | class GenericDebugConfig(DebugConfigBase):
19 | DEFAULT_PORT = ":3333"
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | monitor reset halt
23 | end
24 |
25 | define pio_reset_run_target
26 | monitor reset
27 | end
28 |
29 | target extended-remote $DEBUG_PORT
30 | monitor init
31 | $LOAD_CMDS
32 | pio_reset_halt_target
33 | $INIT_BREAK
34 | """
35 |
--------------------------------------------------------------------------------
/platformio/account/commands/login.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("login", short_help="Log in to PlatformIO Account")
21 | @click.option("-u", "--username", prompt="Username or email")
22 | @click.option("-p", "--password", prompt=True, hide_input=True)
23 | def account_login_cmd(username, password):
24 | client = AccountClient()
25 | client.login(username, password)
26 | click.secho("Successfully logged in!", fg="green")
27 |
--------------------------------------------------------------------------------
/platformio/project/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.project.commands.config import project_config_cmd
18 | from platformio.project.commands.init import project_init_cmd
19 | from platformio.project.commands.metadata import project_metadata_cmd
20 |
21 |
22 | @click.group(
23 | "project",
24 | commands=[
25 | project_config_cmd,
26 | project_init_cmd,
27 | project_metadata_cmd,
28 | ],
29 | short_help="Project Manager",
30 | )
31 | def cli():
32 | pass
33 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/visualstudio/platformio.vcxproj.filters.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;ino;pde
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 |
14 |
15 |
16 | % for file in src_files:
17 |
18 | % if any(file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")):
19 |
20 | Header Files
21 |
22 | % else:
23 |
24 | Source Files
25 |
26 | %end
27 |
28 | % end
29 |
30 |
--------------------------------------------------------------------------------
/platformio/builder/tools/pioasm.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import SCons.Tool.asm # pylint: disable=import-error
16 |
17 | #
18 | # Resolve https://github.com/platformio/platformio-core/issues/3917
19 | # Avoid forcing .S to bare assembly on Windows OS
20 | #
21 |
22 | if ".S" in SCons.Tool.asm.ASSuffixes:
23 | SCons.Tool.asm.ASSuffixes.remove(".S")
24 | if ".S" not in SCons.Tool.asm.ASPPSuffixes:
25 | SCons.Tool.asm.ASPPSuffixes.append(".S")
26 |
27 |
28 | generate = SCons.Tool.asm.generate
29 | exists = SCons.Tool.asm.exists
30 |
--------------------------------------------------------------------------------
/platformio/system/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.system.commands.completion import system_completion_cmd
18 | from platformio.system.commands.info import system_info_cmd
19 | from platformio.system.commands.prune import system_prune_cmd
20 |
21 |
22 | @click.group(
23 | "system",
24 | commands=[
25 | system_completion_cmd,
26 | system_info_cmd,
27 | system_prune_cmd,
28 | ],
29 | short_help="Miscellaneous system commands",
30 | )
31 | def cli():
32 | pass
33 |
--------------------------------------------------------------------------------
/platformio/account/commands/forgot.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("forgot", short_help="Forgot password")
21 | @click.option("--username", prompt="Username or email")
22 | def account_forgot_cmd(username):
23 | client = AccountClient()
24 | client.forgot_password(username)
25 | click.secho(
26 | "If this account is registered, we will send the "
27 | "further instructions to your email.",
28 | fg="green",
29 | )
30 |
--------------------------------------------------------------------------------
/platformio/account/commands/password.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("password", short_help="Change password")
21 | @click.option("--old-password", prompt=True, hide_input=True)
22 | @click.option("--new-password", prompt=True, hide_input=True, confirmation_prompt=True)
23 | def account_password_cmd(old_password, new_password):
24 | client = AccountClient()
25 | client.change_password(old_password, new_password)
26 | click.secho("Password successfully changed!", fg="green")
27 |
--------------------------------------------------------------------------------
/platformio/registry/access/validate.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import re
16 |
17 | import click
18 |
19 | from platformio.account.validate import validate_orgname_teamname, validate_username
20 |
21 |
22 | def validate_urn(value):
23 | value = str(value).strip()
24 | if not re.match(r"^prn:reg:pkg:(\d+):(\w+)$", value, flags=re.I):
25 | raise click.BadParameter("Invalid URN format.")
26 | return value
27 |
28 |
29 | def validate_client(value):
30 | if ":" in value:
31 | validate_orgname_teamname(value)
32 | else:
33 | validate_username(value)
34 | return value
35 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/add.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("add", short_help="Add a new owner to organization")
21 | @click.argument(
22 | "orgname",
23 | )
24 | @click.argument(
25 | "username",
26 | )
27 | def org_add_cmd(orgname, username):
28 | client = AccountClient()
29 | client.add_org_owner(orgname, username)
30 | return click.secho(
31 | "The new owner `%s` has been successfully added to the `%s` organization."
32 | % (username, orgname),
33 | fg="green",
34 | )
35 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/remove.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("remove", short_help="Remove an owner from organization")
21 | @click.argument(
22 | "orgname",
23 | )
24 | @click.argument(
25 | "username",
26 | )
27 | def org_remove_cmd(orgname, username):
28 | client = AccountClient()
29 | client.remove_org_owner(orgname, username)
30 | return click.secho(
31 | "The `%s` owner has been successfully removed from the `%s` organization."
32 | % (username, orgname),
33 | fg="green",
34 | )
35 |
--------------------------------------------------------------------------------
/platformio/test/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.exception import PlatformioException, UserSideException
16 |
17 |
18 | class UnitTestError(PlatformioException):
19 | pass
20 |
21 |
22 | class TestDirNotExistsError(UnitTestError, UserSideException):
23 | MESSAGE = (
24 | "A test folder '{0}' does not exist.\nPlease create 'test' "
25 | "directory in the project root and put a test suite.\n"
26 | "More details about Unit "
27 | "Testing: https://docs.platformio.org/en/latest/advanced/"
28 | "unit-testing/index.html"
29 | )
30 |
31 |
32 | class UnitTestSuiteError(UnitTestError):
33 | pass
34 |
--------------------------------------------------------------------------------
/.github/workflows/deployment.yml:
--------------------------------------------------------------------------------
1 | name: Deployment
2 |
3 | on:
4 | push:
5 | branches:
6 | - "master"
7 | - "release/**"
8 |
9 | jobs:
10 | deployment:
11 | runs-on: ubuntu-latest
12 | environment: production
13 |
14 | steps:
15 | - uses: actions/checkout@v4
16 | with:
17 | submodules: "recursive"
18 |
19 | - name: Set up Python
20 | uses: actions/setup-python@v4
21 | with:
22 | python-version: "3.11"
23 |
24 | - name: Install dependencies
25 | run: |
26 | python -m pip install --upgrade pip
27 | pip install tox build
28 |
29 | - name: Deployment Tests
30 | env:
31 | TEST_EMAIL_LOGIN: ${{ secrets.TEST_EMAIL_LOGIN }}
32 | TEST_EMAIL_PASSWORD: ${{ secrets.TEST_EMAIL_PASSWORD }}
33 | TEST_EMAIL_IMAP_SERVER: ${{ secrets.TEST_EMAIL_IMAP_SERVER }}
34 | run: |
35 | tox -e testcore
36 |
37 | - name: Build Python distributions
38 | run: python -m build
39 |
40 | - name: Publish package to PyPI
41 | if: ${{ github.ref == 'refs/heads/master' }}
42 | uses: pypa/gh-action-pypi-publish@release/v1
43 | with:
44 | user: __token__
45 | password: ${{ secrets.PYPI_API_TOKEN }}
46 |
--------------------------------------------------------------------------------
/platformio/package/manager/tool.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.package.manager.base import BasePackageManager
16 | from platformio.package.meta import PackageType
17 | from platformio.project.config import ProjectConfig
18 |
19 |
20 | class ToolPackageManager(BasePackageManager): # pylint: disable=too-many-ancestors
21 | def __init__(self, package_dir=None):
22 | super().__init__(
23 | PackageType.TOOL,
24 | package_dir
25 | or ProjectConfig.get_instance().get("platformio", "packages_dir"),
26 | )
27 |
28 | @property
29 | def manifest_names(self):
30 | return PackageType.get_manifest_map()[PackageType.TOOL]
31 |
--------------------------------------------------------------------------------
/platformio/home/rpc/handlers/account.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from ajsonrpc.core import JSONRPC20DispatchException
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.home.rpc.handlers.base import BaseRPCHandler
19 |
20 |
21 | class AccountRPC(BaseRPCHandler):
22 | @staticmethod
23 | def call_client(method, *args, **kwargs):
24 | try:
25 | client = AccountClient()
26 | return getattr(client, method)(*args, **kwargs)
27 | except Exception as exc: # pylint: disable=bare-except
28 | raise JSONRPC20DispatchException(
29 | code=5000, message="PIO Account Call Error", data=str(exc)
30 | ) from exc
31 |
--------------------------------------------------------------------------------
/platformio/debug/config/renode.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 |
17 |
18 | class RenodeDebugConfig(DebugConfigBase):
19 | DEFAULT_PORT = ":3333"
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | monitor machine Reset
23 | $LOAD_CMDS
24 | monitor start
25 | end
26 |
27 | define pio_reset_run_target
28 | pio_reset_halt_target
29 | end
30 |
31 | target extended-remote $DEBUG_PORT
32 | $LOAD_CMDS
33 | $INIT_BREAK
34 | monitor start
35 | """
36 |
37 | @property
38 | def server_ready_pattern(self):
39 | return super().server_ready_pattern or (
40 | "GDB server with all CPUs started on port"
41 | )
42 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/destroy.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 |
19 |
20 | @click.command("destroy", short_help="Destroy organization")
21 | @click.argument("orgname")
22 | def org_destroy_cmd(orgname):
23 | client = AccountClient()
24 | click.confirm(
25 | "Are you sure you want to delete the `%s` organization account?\n"
26 | "Warning! All linked data will be permanently removed and can not be restored."
27 | % orgname,
28 | abort=True,
29 | )
30 | client.destroy_org(orgname)
31 | return click.secho(
32 | "Organization `%s` has been destroyed." % orgname,
33 | fg="green",
34 | )
35 |
--------------------------------------------------------------------------------
/platformio/debug/config/jlink.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 |
17 |
18 | class JlinkDebugConfig(DebugConfigBase):
19 | DEFAULT_PORT = ":2331"
20 | GDB_INIT_SCRIPT = """
21 | define pio_reset_halt_target
22 | monitor reset
23 | monitor halt
24 | end
25 |
26 | define pio_reset_run_target
27 | monitor clrbp
28 | monitor reset
29 | monitor go
30 | end
31 |
32 | target extended-remote $DEBUG_PORT
33 | monitor clrbp
34 | monitor speed auto
35 | pio_reset_halt_target
36 | $LOAD_CMDS
37 | $INIT_BREAK
38 | """
39 |
40 | @property
41 | def server_ready_pattern(self):
42 | return super().server_ready_pattern or ("Waiting for GDB connection")
43 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/vscode/.vscode/extensions.json.tpl:
--------------------------------------------------------------------------------
1 | % import json
2 | % import os
3 | % import re
4 | %
5 | % recommendations = set(["platformio.platformio-ide"])
6 | % unwantedRecommendations = set(["ms-vscode.cpptools-extension-pack"])
7 | % previous_json = os.path.join(project_dir, ".vscode", "extensions.json")
8 | % if os.path.isfile(previous_json):
9 | % fp = open(previous_json)
10 | % contents = re.sub(r"^\s*//.*$", "", fp.read(), flags=re.M).strip()
11 | % fp.close()
12 | % if contents:
13 | % try:
14 | % data = json.loads(contents)
15 | % recommendations |= set(data.get("recommendations", []))
16 | % unwantedRecommendations |= set(data.get("unwantedRecommendations", []))
17 | % except ValueError:
18 | % pass
19 | % end
20 | % end
21 | % end
22 | {
23 | // See http://go.microsoft.com/fwlink/?LinkId=827846
24 | // for the documentation about the extensions.json format
25 | "recommendations": [
26 | % for i, item in enumerate(sorted(recommendations)):
27 | "{{ item }}"{{ ("," if (i + 1) < len(recommendations) else "") }}
28 | % end
29 | ],
30 | "unwantedRecommendations": [
31 | % for i, item in enumerate(sorted(unwantedRecommendations)):
32 | "{{ item }}"{{ ("," if (i + 1) < len(unwantedRecommendations) else "") }}
33 | % end
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/platformio/debug/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.exception import PlatformioException, UserSideException
16 |
17 |
18 | class DebugError(PlatformioException):
19 | pass
20 |
21 |
22 | class DebugSupportError(DebugError, UserSideException):
23 | MESSAGE = (
24 | "Currently, PlatformIO does not support debugging for `{0}`.\n"
25 | "Please request support at https://github.com/platformio/"
26 | "platformio-core/issues \nor visit -> https://docs.platformio.org"
27 | "/page/plus/debugging.html"
28 | )
29 |
30 |
31 | class DebugInvalidOptionsError(DebugError, UserSideException):
32 | pass
33 |
34 |
35 | class DebugInitError(DebugError, UserSideException):
36 | pass
37 |
--------------------------------------------------------------------------------
/platformio/test/reports/base.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import importlib
16 |
17 | from platformio.test.result import TestResult
18 |
19 |
20 | class TestReportBase:
21 | def __init__(self, test_result):
22 | self.test_result = test_result
23 |
24 | def generate(self, output_path, verbose):
25 | raise NotImplementedError()
26 |
27 |
28 | class TestReportFactory:
29 | @staticmethod
30 | def new(format, test_result) -> TestReportBase: # pylint: disable=redefined-builtin
31 | assert isinstance(test_result, TestResult)
32 | mod = importlib.import_module(f"platformio.test.reports.{format}")
33 | report_cls = getattr(mod, "%sTestReport" % format.lower().capitalize())
34 | return report_cls(test_result)
35 |
--------------------------------------------------------------------------------
/platformio/registry/access/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.registry.access.commands.grant import access_grant_cmd
18 | from platformio.registry.access.commands.list import access_list_cmd
19 | from platformio.registry.access.commands.private import access_private_cmd
20 | from platformio.registry.access.commands.public import access_public_cmd
21 | from platformio.registry.access.commands.revoke import access_revoke_cmd
22 |
23 |
24 | @click.group(
25 | "access",
26 | commands=[
27 | access_grant_cmd,
28 | access_list_cmd,
29 | access_private_cmd,
30 | access_public_cmd,
31 | access_revoke_cmd,
32 | ],
33 | short_help="Manage resource access",
34 | )
35 | def cli():
36 | pass
37 |
--------------------------------------------------------------------------------
/platformio/account/commands/token.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | import click
18 |
19 | from platformio.account.client import AccountClient
20 |
21 |
22 | @click.command("token", short_help="Get or regenerate Authentication Token")
23 | @click.option("-p", "--password", prompt=True, hide_input=True)
24 | @click.option("--regenerate", is_flag=True)
25 | @click.option("--json-output", is_flag=True)
26 | def account_token_cmd(password, regenerate, json_output):
27 | client = AccountClient()
28 | auth_token = client.auth_token(password, regenerate)
29 | if json_output:
30 | click.echo(json.dumps({"status": "success", "result": auth_token}))
31 | return
32 | click.secho("Personal Authentication Token: %s" % auth_token, fg="green")
33 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/private.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.registry.access.validate import validate_urn
18 | from platformio.registry.client import RegistryClient
19 |
20 |
21 | @click.command("private", short_help="Make resource private")
22 | @click.argument(
23 | "urn",
24 | callback=lambda _, __, value: validate_urn(value),
25 | )
26 | @click.option("--urn-type", type=click.Choice(["prn:reg:pkg"]), default="prn:reg:pkg")
27 | def access_private_cmd(urn, urn_type): # pylint: disable=unused-argument
28 | client = RegistryClient()
29 | client.update_resource(urn=urn, private=1)
30 | return click.secho(
31 | "The resource %s has been successfully updated." % urn,
32 | fg="green",
33 | )
34 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/public.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.registry.access.validate import validate_urn
18 | from platformio.registry.client import RegistryClient
19 |
20 |
21 | @click.command("public", short_help="Make resource public")
22 | @click.argument(
23 | "urn",
24 | callback=lambda _, __, value: validate_urn(value),
25 | )
26 | @click.option("--urn-type", type=click.Choice(["prn:reg:pkg"]), default="prn:reg:pkg")
27 | def access_public_cmd(urn, urn_type): # pylint: disable=unused-argument
28 | client = RegistryClient()
29 | client.update_resource(urn=urn, private=0)
30 | return click.secho(
31 | "The resource %s has been successfully updated." % urn,
32 | fg="green",
33 | )
34 |
--------------------------------------------------------------------------------
/platformio/commands/update.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 |
18 | @click.command(
19 | "update",
20 | short_help="Update installed platforms, packages and libraries",
21 | hidden=True,
22 | )
23 | @click.option("--core-packages", is_flag=True, help="Update only the core packages")
24 | @click.option(
25 | "-c",
26 | "--only-check",
27 | is_flag=True,
28 | help="DEPRECATED. Please use `--dry-run` instead",
29 | )
30 | @click.option(
31 | "--dry-run", is_flag=True, help="Do not update, only check for the new versions"
32 | )
33 | def cli(*_, **__):
34 | click.secho(
35 | "This command is deprecated and will be removed in the next releases. \n"
36 | "Please use `pio pkg update` instead.",
37 | fg="yellow",
38 | )
39 |
--------------------------------------------------------------------------------
/platformio/home/rpc/handlers/registry.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from ajsonrpc.core import JSONRPC20DispatchException
16 |
17 | from platformio.compat import aio_to_thread
18 | from platformio.home.rpc.handlers.base import BaseRPCHandler
19 | from platformio.registry.client import RegistryClient
20 |
21 |
22 | class RegistryRPC(BaseRPCHandler):
23 | @staticmethod
24 | async def call_client(method, *args, **kwargs):
25 | try:
26 | client = RegistryClient()
27 | return await aio_to_thread(getattr(client, method), *args, **kwargs)
28 | except Exception as exc: # pylint: disable=bare-except
29 | raise JSONRPC20DispatchException(
30 | code=5000, message="Registry Call Error", data=str(exc)
31 | ) from exc
32 |
--------------------------------------------------------------------------------
/platformio/account/commands/destroy.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient, AccountNotAuthorized
18 |
19 |
20 | @click.command("destroy", short_help="Destroy account")
21 | def account_destroy_cmd():
22 | client = AccountClient()
23 | click.confirm(
24 | "Are you sure you want to delete the %s user account?\n"
25 | "Warning! All linked data will be permanently removed and can not be restored."
26 | % client.get_logged_username(),
27 | abort=True,
28 | )
29 | client.destroy_account()
30 | try:
31 | client.logout()
32 | except AccountNotAuthorized:
33 | pass
34 | click.secho(
35 | "User account has been destroyed.",
36 | fg="green",
37 | )
38 |
--------------------------------------------------------------------------------
/scripts/fixsymlink.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from os import chdir, getcwd, readlink, remove, symlink, walk
16 | from os.path import exists, islink, join, relpath
17 | from sys import exit as sys_exit
18 |
19 |
20 | def fix_symlink(root, fname, brokenlink):
21 | print(root, fname, brokenlink)
22 | prevcwd = getcwd()
23 |
24 | chdir(root)
25 | remove(fname)
26 | symlink(relpath(brokenlink, root), fname)
27 | chdir(prevcwd)
28 |
29 |
30 | def main():
31 | for root, dirnames, filenames in walk("."):
32 | for f in filenames:
33 | path = join(root, f)
34 | if not islink(path) or exists(path):
35 | continue
36 | fix_symlink(root, f, readlink(path))
37 |
38 |
39 | if __name__ == "__main__":
40 | sys_exit(main())
41 |
--------------------------------------------------------------------------------
/platformio/account/org/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.org.commands.add import org_add_cmd
18 | from platformio.account.org.commands.create import org_create_cmd
19 | from platformio.account.org.commands.destroy import org_destroy_cmd
20 | from platformio.account.org.commands.list import org_list_cmd
21 | from platformio.account.org.commands.remove import org_remove_cmd
22 | from platformio.account.org.commands.update import org_update_cmd
23 |
24 |
25 | @click.group(
26 | "account",
27 | commands=[
28 | org_add_cmd,
29 | org_create_cmd,
30 | org_destroy_cmd,
31 | org_list_cmd,
32 | org_remove_cmd,
33 | org_update_cmd,
34 | ],
35 | short_help="Manage organizations",
36 | )
37 | def cli():
38 | pass
39 |
--------------------------------------------------------------------------------
/platformio/account/team/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.team.commands.add import team_add_cmd
18 | from platformio.account.team.commands.create import team_create_cmd
19 | from platformio.account.team.commands.destroy import team_destroy_cmd
20 | from platformio.account.team.commands.list import team_list_cmd
21 | from platformio.account.team.commands.remove import team_remove_cmd
22 | from platformio.account.team.commands.update import team_update_cmd
23 |
24 |
25 | @click.group(
26 | "team",
27 | commands=[
28 | team_add_cmd,
29 | team_create_cmd,
30 | team_destroy_cmd,
31 | team_list_cmd,
32 | team_remove_cmd,
33 | team_update_cmd,
34 | ],
35 | short_help="Manage organization teams",
36 | )
37 | def cli():
38 | pass
39 |
--------------------------------------------------------------------------------
/platformio/device/monitor/filters/send_on_enter.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
16 |
17 |
18 | class SendOnEnter(DeviceMonitorFilterBase):
19 | NAME = "send_on_enter"
20 |
21 | def __init__(self, *args, **kwargs):
22 | super().__init__(*args, **kwargs)
23 | self._buffer = ""
24 |
25 | if self.options.get("eol") == "CR":
26 | self._eol = "\r"
27 | elif self.options.get("eol") == "LF":
28 | self._eol = "\n"
29 | else:
30 | self._eol = "\r\n"
31 |
32 | def tx(self, text):
33 | self._buffer += text
34 | if self._buffer.endswith(self._eol):
35 | text = self._buffer
36 | self._buffer = ""
37 | return text
38 | return ""
39 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/create.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_orgname_teamname
19 |
20 |
21 | @click.command("create", short_help="Create a new team")
22 | @click.argument(
23 | "orgname_teamname",
24 | metavar="ORGNAME:TEAMNAME",
25 | callback=lambda _, __, value: validate_orgname_teamname(value),
26 | )
27 | @click.option(
28 | "--description",
29 | )
30 | def team_create_cmd(orgname_teamname, description):
31 | orgname, teamname = orgname_teamname.split(":", 1)
32 | client = AccountClient()
33 | client.create_team(orgname, teamname, description)
34 | return click.secho(
35 | "The team %s has been successfully created." % teamname,
36 | fg="green",
37 | )
38 |
--------------------------------------------------------------------------------
/platformio/check/tools/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio import exception
16 | from platformio.check.tools.clangtidy import ClangtidyCheckTool
17 | from platformio.check.tools.cppcheck import CppcheckCheckTool
18 | from platformio.check.tools.pvsstudio import PvsStudioCheckTool
19 |
20 |
21 | class CheckToolFactory:
22 | @staticmethod
23 | def new(tool, project_dir, config, envname, options):
24 | cls = None
25 | if tool == "cppcheck":
26 | cls = CppcheckCheckTool
27 | elif tool == "clangtidy":
28 | cls = ClangtidyCheckTool
29 | elif tool == "pvs-studio":
30 | cls = PvsStudioCheckTool
31 | else:
32 | raise exception.PlatformioException("Unknown check tool `%s`" % tool)
33 | return cls(project_dir, config, envname, options)
34 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/create.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_email, validate_orgname
19 |
20 |
21 | @click.command("create", short_help="Create a new organization")
22 | @click.argument(
23 | "orgname",
24 | callback=lambda _, __, value: validate_orgname(value),
25 | )
26 | @click.option(
27 | "--email", callback=lambda _, __, value: validate_email(value) if value else value
28 | )
29 | @click.option(
30 | "--displayname",
31 | )
32 | def org_create_cmd(orgname, email, displayname):
33 | client = AccountClient()
34 | client.create_org(orgname, email, displayname)
35 | return click.secho(
36 | "The organization `%s` has been successfully created." % orgname,
37 | fg="green",
38 | )
39 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/remove.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_orgname_teamname
19 |
20 |
21 | @click.command("remove", short_help="Remove a member from team")
22 | @click.argument(
23 | "orgname_teamname",
24 | metavar="ORGNAME:TEAMNAME",
25 | callback=lambda _, __, value: validate_orgname_teamname(value),
26 | )
27 | @click.argument("username")
28 | def team_remove_cmd(orgname_teamname, username):
29 | orgname, teamname = orgname_teamname.split(":", 1)
30 | client = AccountClient()
31 | client.remove_team_member(orgname, teamname, username)
32 | return click.secho(
33 | "The %s member has been successfully removed from the %s team."
34 | % (username, teamname),
35 | fg="green",
36 | )
37 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/add.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_orgname_teamname
19 |
20 |
21 | @click.command("add", short_help="Add a new member to team")
22 | @click.argument(
23 | "orgname_teamname",
24 | metavar="ORGNAME:TEAMNAME",
25 | callback=lambda _, __, value: validate_orgname_teamname(value),
26 | )
27 | @click.argument(
28 | "username",
29 | )
30 | def team_add_cmd(orgname_teamname, username):
31 | orgname, teamname = orgname_teamname.split(":", 1)
32 | client = AccountClient()
33 | client.add_team_member(orgname, teamname, username)
34 | return click.secho(
35 | "The new member %s has been successfully added to the %s team."
36 | % (username, teamname),
37 | fg="green",
38 | )
39 |
--------------------------------------------------------------------------------
/platformio/remote/client/agent_list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from datetime import datetime
16 |
17 | import click
18 |
19 | from platformio.remote.client.base import RemoteClientBase
20 |
21 |
22 | class AgentListClient(RemoteClientBase):
23 | def agent_pool_ready(self):
24 | d = self.agentpool.callRemote("list", True)
25 | d.addCallback(self._cbResult)
26 | d.addErrback(self.cb_global_error)
27 |
28 | def _cbResult(self, result):
29 | for item in result:
30 | click.secho(item["name"], fg="cyan")
31 | click.echo("-" * len(item["name"]))
32 | click.echo("ID: %s" % item["id"])
33 | click.echo(
34 | "Started: %s"
35 | % datetime.fromtimestamp(item["started"]).strftime("%Y-%m-%d %H:%M:%S")
36 | )
37 | click.echo("")
38 | self.disconnect()
39 |
--------------------------------------------------------------------------------
/.github/workflows/core.yml:
--------------------------------------------------------------------------------
1 | name: Core
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | strategy:
8 | fail-fast: false
9 | matrix:
10 | os: [ubuntu-latest, windows-latest, macos-latest]
11 | python-version: ["3.11", "3.12", "3.13", "3.14"]
12 |
13 | runs-on: ${{ matrix.os }}
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | with:
18 | submodules: "recursive"
19 |
20 | - name: Set up Python ${{ matrix.python-version }}
21 | uses: actions/setup-python@v5
22 | with:
23 | python-version: ${{ matrix.python-version }}
24 |
25 | - name: Install dependencies
26 | run: |
27 | python -m pip install --upgrade pip
28 | pip install tox
29 |
30 | - name: Run "codespell" on Linux
31 | if: startsWith(matrix.os, 'ubuntu')
32 | run: |
33 | python -m pip install codespell
34 | make codespell
35 |
36 | - name: Core System Info
37 | run: |
38 | tox -e py
39 |
40 | - name: Integration Tests
41 | if: ${{ matrix.python-version == '3.11' }}
42 | run: |
43 | tox -e testcore
44 |
45 | - name: Slack Notification
46 | uses: homoluctus/slatify@master
47 | if: failure()
48 | with:
49 | type: ${{ job.status }}
50 | job_name: '*Core*'
51 | commit: true
52 | url: ${{ secrets.SLACK_BUILD_WEBHOOK }}
53 | token: ${{ secrets.SLACK_GITHUB_TOKEN }}
54 |
--------------------------------------------------------------------------------
/platformio/device/monitor/filters/time.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from datetime import datetime
16 |
17 | from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
18 |
19 |
20 | class Timestamp(DeviceMonitorFilterBase):
21 | NAME = "time"
22 |
23 | def __init__(self, *args, **kwargs):
24 | super().__init__(*args, **kwargs)
25 | self._line_started = False
26 |
27 | def rx(self, text):
28 | if self._line_started and "\n" not in text:
29 | return text
30 | timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
31 | if not self._line_started:
32 | self._line_started = True
33 | text = "%s > %s" % (timestamp, text)
34 | if text.endswith("\n"):
35 | self._line_started = False
36 | return text[:-1].replace("\n", "\n%s > " % timestamp) + "\n"
37 | return text.replace("\n", "\n%s > " % timestamp)
38 |
--------------------------------------------------------------------------------
/platformio/public.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-import
16 |
17 | from platformio.device.list.util import list_logical_devices, list_serial_ports
18 | from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
19 | from platformio.fs import to_unix_path
20 | from platformio.platform.base import PlatformBase
21 | from platformio.project.config import ProjectConfig
22 | from platformio.project.helpers import get_project_watch_lib_dirs, load_build_metadata
23 | from platformio.project.options import get_config_options_schema
24 | from platformio.test.result import TestCase, TestCaseSource, TestStatus
25 | from platformio.test.runners.base import TestRunnerBase
26 | from platformio.test.runners.doctest import DoctestTestRunner
27 | from platformio.test.runners.googletest import GoogletestTestRunner
28 | from platformio.test.runners.unity import UnityTestRunner
29 | from platformio.util import get_systype
30 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/destroy.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_orgname_teamname
19 |
20 |
21 | @click.command("destroy", short_help="Destroy a team")
22 | @click.argument(
23 | "orgname_teamname",
24 | metavar="ORGNAME:TEAMNAME",
25 | callback=lambda _, __, value: validate_orgname_teamname(value),
26 | )
27 | def team_destroy_cmd(orgname_teamname):
28 | orgname, teamname = orgname_teamname.split(":", 1)
29 | click.confirm(
30 | click.style(
31 | "Are you sure you want to destroy the %s team?" % teamname, fg="yellow"
32 | ),
33 | abort=True,
34 | )
35 | client = AccountClient()
36 | client.destroy_team(orgname, teamname)
37 | return click.secho(
38 | "The team %s has been successfully destroyed." % teamname,
39 | fg="green",
40 | )
41 |
--------------------------------------------------------------------------------
/platformio/platform/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.exception import UserSideException
16 |
17 |
18 | class PlatformException(UserSideException):
19 | pass
20 |
21 |
22 | class UnknownPlatform(PlatformException):
23 | MESSAGE = "Unknown development platform '{0}'"
24 |
25 |
26 | class IncompatiblePlatform(PlatformException):
27 | MESSAGE = (
28 | "Development platform '{0}' is not compatible with PlatformIO Core v{1} and "
29 | "depends on PlatformIO Core {2}.\n"
30 | )
31 |
32 |
33 | class UnknownBoard(PlatformException):
34 | MESSAGE = "Unknown board ID '{0}'"
35 |
36 |
37 | class InvalidBoardManifest(PlatformException):
38 | MESSAGE = "Invalid board JSON manifest '{0}'"
39 |
40 |
41 | class UnknownFramework(PlatformException):
42 | MESSAGE = "Unknown framework '{0}'"
43 |
44 |
45 | class BuildScriptNotFound(PlatformException):
46 | MESSAGE = "Invalid path '{0}' to build script"
47 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/revoke.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.registry.access.validate import validate_client, validate_urn
18 | from platformio.registry.client import RegistryClient
19 |
20 |
21 | @click.command("revoke", short_help="Revoke access")
22 | @click.argument(
23 | "client",
24 | metavar="[ORGNAME:TEAMNAME|USERNAME]",
25 | callback=lambda _, __, value: validate_client(value),
26 | )
27 | @click.argument(
28 | "urn",
29 | callback=lambda _, __, value: validate_urn(value),
30 | )
31 | @click.option("--urn-type", type=click.Choice(["prn:reg:pkg"]), default="prn:reg:pkg")
32 | def access_revoke_cmd(client, urn, urn_type): # pylint: disable=unused-argument
33 | reg_client = RegistryClient()
34 | reg_client.revoke_access_from_resource(urn=urn, client=client)
35 | return click.secho(
36 | "Access for resource %s has been revoked for %s" % (urn, client),
37 | fg="green",
38 | )
39 |
--------------------------------------------------------------------------------
/platformio/remote/ac/process.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 |
17 | from twisted.internet import protocol, reactor # pylint: disable=import-error
18 |
19 | from platformio.remote.ac.base import AsyncCommandBase
20 |
21 |
22 | class ProcessAsyncCmd(protocol.ProcessProtocol, AsyncCommandBase):
23 | def start(self):
24 | env = dict(os.environ).copy()
25 | env.update({"PLATFORMIO_FORCE_ANSI": "true"})
26 | reactor.spawnProcess(
27 | self, self.options["executable"], self.options["args"], env
28 | )
29 |
30 | def outReceived(self, data):
31 | self._ac_ondata(data)
32 |
33 | def errReceived(self, data):
34 | self._ac_ondata(data)
35 |
36 | def processExited(self, reason):
37 | self._return_code = reason.value.exitCode
38 |
39 | def processEnded(self, reason):
40 | if self._return_code is None:
41 | self._return_code = reason.value.exitCode
42 | self._ac_ended()
43 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/examples/strmultilines/main.ino:
--------------------------------------------------------------------------------
1 | const char headerEndP[] PROGMEM =
2 | "\
3 | \
4 | \
5 | ";
6 |
7 | void setup() {
8 |
9 | }
10 |
11 | const char javaScriptPinControlP[] PROGMEM =
12 | "\
13 | \
14 | ";
74 |
75 | #warning "Line 75"
76 |
77 | void loop() {
78 |
79 | }
--------------------------------------------------------------------------------
/platformio/remote/factory/ssl.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import certifi
16 | from OpenSSL import SSL # pylint: disable=import-error
17 | from twisted.internet import ssl # pylint: disable=import-error
18 |
19 |
20 | class SSLContextFactory(ssl.ClientContextFactory):
21 | def __init__(self, host):
22 | self.host = host
23 | self.certificate_verified = False
24 |
25 | def getContext(self):
26 | ctx = super().getContext()
27 | ctx.set_verify(
28 | SSL.VERIFY_PEER | SSL.VERIFY_FAIL_IF_NO_PEER_CERT, self.verifyHostname
29 | )
30 | ctx.load_verify_locations(certifi.where())
31 | return ctx
32 |
33 | def verifyHostname( # pylint: disable=unused-argument,too-many-arguments,too-many-positional-arguments
34 | self, connection, x509, errno, depth, status
35 | ):
36 | cn = x509.get_subject().commonName
37 | if cn.startswith("*"):
38 | cn = cn[1:]
39 | if self.host.endswith(cn):
40 | self.certificate_verified = True
41 | return status
42 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/grant.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.registry.access.validate import validate_client, validate_urn
18 | from platformio.registry.client import RegistryClient
19 |
20 |
21 | @click.command("grant", short_help="Grant access")
22 | @click.argument("level", type=click.Choice(["admin", "maintainer", "guest"]))
23 | @click.argument(
24 | "client",
25 | metavar="[|]",
26 | callback=lambda _, __, value: validate_client(value),
27 | )
28 | @click.argument(
29 | "urn",
30 | callback=lambda _, __, value: validate_urn(value),
31 | )
32 | @click.option("--urn-type", type=click.Choice(["prn:reg:pkg"]), default="prn:reg:pkg")
33 | def access_grant_cmd(level, client, urn, urn_type): # pylint: disable=unused-argument
34 | reg_client = RegistryClient()
35 | reg_client.grant_access_for_resource(urn=urn, client=client, level=level)
36 | return click.secho(
37 | "Access for resource %s has been granted for %s" % (urn, client),
38 | fg="green",
39 | )
40 |
--------------------------------------------------------------------------------
/platformio/device/monitor/filters/hexlify.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import serial
16 |
17 | from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
18 |
19 |
20 | class Hexlify(DeviceMonitorFilterBase):
21 | NAME = "hexlify"
22 |
23 | def __init__(self, *args, **kwargs):
24 | super().__init__(*args, **kwargs)
25 | self._counter = 0
26 |
27 | def set_running_terminal(self, terminal):
28 | # force to Latin-1, issue #4732
29 | if terminal.input_encoding == "UTF-8":
30 | terminal.set_rx_encoding("Latin-1")
31 | super().set_running_terminal(terminal)
32 |
33 | def rx(self, text):
34 | result = ""
35 | for c in serial.iterbytes(text):
36 | if (self._counter % 16) == 0:
37 | result += "\n{:04X} | ".format(self._counter)
38 | asciicode = ord(c)
39 | if asciicode <= 255:
40 | result += "{:02X} ".format(asciicode)
41 | else:
42 | result += "?? "
43 | self._counter += 1
44 | return result
45 |
--------------------------------------------------------------------------------
/platformio/device/monitor/filters/log2file.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import io
16 | import os
17 | from datetime import datetime
18 |
19 | from platformio.device.monitor.filters.base import DeviceMonitorFilterBase
20 |
21 |
22 | class LogToFile(DeviceMonitorFilterBase):
23 | NAME = "log2file"
24 |
25 | def __init__(self, *args, **kwargs):
26 | super().__init__(*args, **kwargs)
27 | self._log_fp = None
28 |
29 | def __call__(self):
30 | if not os.path.isdir("logs"):
31 | os.makedirs("logs")
32 | log_file_name = os.path.join(
33 | "logs", "device-monitor-%s.log" % datetime.now().strftime("%y%m%d-%H%M%S")
34 | )
35 | print("--- Logging an output to %s" % os.path.abspath(log_file_name))
36 | # pylint: disable=consider-using-with
37 | self._log_fp = io.open(log_file_name, "w", encoding="utf-8")
38 | return self
39 |
40 | def __del__(self):
41 | if self._log_fp:
42 | self._log_fp.close()
43 |
44 | def rx(self, text):
45 | self._log_fp.write(text)
46 | self._log_fp.flush()
47 | return text
48 |
--------------------------------------------------------------------------------
/platformio/account/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.commands.destroy import account_destroy_cmd
18 | from platformio.account.commands.forgot import account_forgot_cmd
19 | from platformio.account.commands.login import account_login_cmd
20 | from platformio.account.commands.logout import account_logout_cmd
21 | from platformio.account.commands.password import account_password_cmd
22 | from platformio.account.commands.register import account_register_cmd
23 | from platformio.account.commands.show import account_show_cmd
24 | from platformio.account.commands.token import account_token_cmd
25 | from platformio.account.commands.update import account_update_cmd
26 |
27 |
28 | @click.group(
29 | "account",
30 | commands=[
31 | account_destroy_cmd,
32 | account_forgot_cmd,
33 | account_login_cmd,
34 | account_logout_cmd,
35 | account_password_cmd,
36 | account_register_cmd,
37 | account_show_cmd,
38 | account_token_cmd,
39 | account_update_cmd,
40 | ],
41 | short_help="Manage PlatformIO account",
42 | )
43 | def cli():
44 | pass
45 |
--------------------------------------------------------------------------------
/platformio/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | VERSION = (6, 1, "19a2")
16 | __version__ = ".".join([str(s) for s in VERSION])
17 |
18 | __title__ = "platformio"
19 | __description__ = (
20 | "Your Gateway to Embedded Software Development Excellence. "
21 | "Unlock the true potential of embedded software development "
22 | "with PlatformIO's collaborative ecosystem, embracing "
23 | "declarative principles, test-driven methodologies, and "
24 | "modern toolchains for unrivaled success."
25 | )
26 | __url__ = "https://platformio.org"
27 |
28 | __author__ = "PlatformIO Labs"
29 | __email__ = "contact@piolabs.com"
30 |
31 | __license__ = "Apache Software License"
32 | __copyright__ = "Copyright 2014-present PlatformIO Labs"
33 |
34 | __accounts_api__ = "https://api.accounts.platformio.org"
35 | __registry_mirror_hosts__ = [
36 | "registry.platformio.org",
37 | "registry.nm1.platformio.org",
38 | ]
39 | __pioremote_endpoint__ = "ssl:host=remote.platformio.org:port=4413"
40 |
41 | __check_internet_hosts__ = [
42 | "185.199.110.153", # Github.com
43 | "88.198.170.159", # platformio.org
44 | "github.com",
45 | ] + __registry_mirror_hosts__
46 |
--------------------------------------------------------------------------------
/platformio/package/commands/pack.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 |
17 | import click
18 |
19 | from platformio.package.manifest.parser import ManifestParserFactory
20 | from platformio.package.manifest.schema import ManifestSchema, ManifestValidationError
21 | from platformio.package.pack import PackagePacker
22 |
23 |
24 | @click.command("pack", short_help="Create a tarball from a package")
25 | @click.argument(
26 | "package",
27 | default=os.getcwd,
28 | metavar="",
29 | type=click.Path(exists=True, file_okay=True, dir_okay=True),
30 | )
31 | @click.option(
32 | "-o", "--output", help="A destination path (folder or a full path to file)"
33 | )
34 | def package_pack_cmd(package, output):
35 | p = PackagePacker(package)
36 | archive_path = p.pack(output)
37 | # validate manifest
38 | try:
39 | ManifestSchema().load_manifest(
40 | ManifestParserFactory.new_from_archive(archive_path).as_dict()
41 | )
42 | except ManifestValidationError as exc:
43 | os.remove(archive_path)
44 | raise exc
45 | click.secho('Wrote a tarball to "%s"' % archive_path, fg="green")
46 |
--------------------------------------------------------------------------------
/platformio/run/helpers.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from os import makedirs
16 | from os.path import isdir, isfile, join
17 |
18 | from platformio import fs
19 | from platformio.project.helpers import compute_project_checksum, get_project_dir
20 |
21 | KNOWN_CLEAN_TARGETS = ("clean",)
22 | KNOWN_FULLCLEAN_TARGETS = ("cleanall", "fullclean")
23 | KNOWN_ALLCLEAN_TARGETS = KNOWN_CLEAN_TARGETS + KNOWN_FULLCLEAN_TARGETS
24 |
25 |
26 | def clean_build_dir(build_dir, config):
27 | # remove legacy ".pioenvs" folder
28 | legacy_build_dir = join(get_project_dir(), ".pioenvs")
29 | if isdir(legacy_build_dir) and legacy_build_dir != build_dir:
30 | fs.rmtree(legacy_build_dir)
31 |
32 | checksum_file = join(build_dir, "project.checksum")
33 | checksum = compute_project_checksum(config)
34 |
35 | if isdir(build_dir):
36 | # check project structure
37 | if isfile(checksum_file):
38 | with open(checksum_file, encoding="utf8") as fp:
39 | if fp.read() == checksum:
40 | return
41 | fs.rmtree(build_dir)
42 |
43 | makedirs(build_dir)
44 | with open(checksum_file, mode="w", encoding="utf8") as fp:
45 | fp.write(checksum)
46 |
--------------------------------------------------------------------------------
/.github/workflows/projects.yml:
--------------------------------------------------------------------------------
1 | name: Projects
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build:
7 | strategy:
8 | fail-fast: false
9 | matrix:
10 | project:
11 | - marlin:
12 | repository: "MarlinFirmware/Marlin"
13 | folder: "Marlin"
14 | config_dir: "Marlin"
15 | env_name: "mega2560"
16 | - smartknob:
17 | repository: "scottbez1/smartknob"
18 | folder: "smartknob"
19 | config_dir: "smartknob"
20 | env_name: "view"
21 | - espurna:
22 | repository: "xoseperez/espurna"
23 | folder: "espurna"
24 | config_dir: "espurna/code"
25 | env_name: "nodemcu-lolin"
26 | - OpenMQTTGateway:
27 | repository: "1technophile/OpenMQTTGateway"
28 | folder: "OpenMQTTGateway"
29 | config_dir: "OpenMQTTGateway"
30 | env_name: "esp32-m5atom-lite"
31 | os: [ubuntu-latest, windows-latest, macos-latest]
32 |
33 | runs-on: ${{ matrix.os }}
34 | steps:
35 | - uses: actions/checkout@v4
36 | with:
37 | submodules: "recursive"
38 |
39 | - name: Set up Python ${{ matrix.python-version }}
40 | uses: actions/setup-python@v4
41 | with:
42 | python-version: 3.11
43 |
44 | - name: Install PlatformIO
45 | run: pip install -U .
46 |
47 | - name: Check out ${{ matrix.project.repository }}
48 | uses: actions/checkout@v4
49 | with:
50 | submodules: "recursive"
51 | repository: ${{ matrix.project.repository }}
52 | path: ${{ matrix.project.folder }}
53 |
54 | - name: Compile ${{ matrix.project.repository }}
55 | run: pio run -d ${{ matrix.project.config_dir }} -e ${{ matrix.project.env_name }}
56 |
57 |
--------------------------------------------------------------------------------
/platformio/package/commands/unpublish.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.package.meta import PackageSpec, PackageType
19 | from platformio.registry.client import RegistryClient
20 |
21 |
22 | @click.command("unpublish", short_help="Remove a pushed package from the registry")
23 | @click.argument(
24 | "package", required=True, metavar="[/][@]"
25 | )
26 | @click.option(
27 | "--type",
28 | type=click.Choice(list(PackageType.items().values())),
29 | default="library",
30 | help="Package type, default is set to `library`",
31 | )
32 | @click.option(
33 | "--undo",
34 | is_flag=True,
35 | help="Undo a remove, putting a version back into the registry",
36 | )
37 | def package_unpublish_cmd(package, type, undo): # pylint: disable=redefined-builtin
38 | spec = PackageSpec(package)
39 | response = RegistryClient().unpublish_package(
40 | owner=spec.owner or AccountClient().get_logged_username(),
41 | type=type,
42 | name=spec.name,
43 | version=str(spec.requirements),
44 | undo=undo,
45 | )
46 | click.secho(response.get("message"), fg="green")
47 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | import click
18 | from tabulate import tabulate
19 |
20 | from platformio.account.client import AccountClient
21 |
22 |
23 | @click.command("list", short_help="List organizations and their members")
24 | @click.option("--json-output", is_flag=True)
25 | def org_list_cmd(json_output):
26 | client = AccountClient()
27 | orgs = client.list_orgs()
28 | if json_output:
29 | return click.echo(json.dumps(orgs))
30 | if not orgs:
31 | return click.echo("You do not have any organization")
32 | for org in orgs:
33 | click.echo()
34 | click.secho(org.get("orgname"), fg="cyan")
35 | click.echo("-" * len(org.get("orgname")))
36 | data = []
37 | if org.get("displayname"):
38 | data.append(("Display Name:", org.get("displayname")))
39 | if org.get("email"):
40 | data.append(("Email:", org.get("email")))
41 | data.append(
42 | (
43 | "Owners:",
44 | ", ".join((owner.get("username") for owner in org.get("owners"))),
45 | )
46 | )
47 | click.echo(tabulate(data, tablefmt="plain"))
48 | return click.echo()
49 |
--------------------------------------------------------------------------------
/platformio/builder/tools/piohooks.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 |
16 | def AddActionWrapper(handler):
17 | def wraps(env, files, action):
18 | if not isinstance(files, (list, tuple, set)):
19 | files = [files]
20 | known_nodes = []
21 | unknown_files = []
22 | for item in files:
23 | nodes = env.arg2nodes(item, env.fs.Entry)
24 | if nodes and nodes[0].exists():
25 | known_nodes.extend(nodes)
26 | else:
27 | unknown_files.append(item)
28 | if unknown_files:
29 | env.Append(**{"_PIO_DELAYED_ACTIONS": [(handler, unknown_files, action)]})
30 | if known_nodes:
31 | return handler(known_nodes, action)
32 | return []
33 |
34 | return wraps
35 |
36 |
37 | def ProcessDelayedActions(env):
38 | for func, nodes, action in env.get("_PIO_DELAYED_ACTIONS", []):
39 | func(nodes, action)
40 |
41 |
42 | def generate(env):
43 | env.Replace(**{"_PIO_DELAYED_ACTIONS": []})
44 | env.AddMethod(AddActionWrapper(env.AddPreAction), "AddPreAction")
45 | env.AddMethod(AddActionWrapper(env.AddPostAction), "AddPostAction")
46 | env.AddMethod(ProcessDelayedActions)
47 |
48 |
49 | def exists(_):
50 | return True
51 |
--------------------------------------------------------------------------------
/platformio/account/commands/register.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import (
19 | validate_email,
20 | validate_password,
21 | validate_username,
22 | )
23 |
24 |
25 | @click.command("register", short_help="Create new PlatformIO Account")
26 | @click.option(
27 | "-u",
28 | "--username",
29 | prompt=True,
30 | callback=lambda _, __, value: validate_username(value),
31 | )
32 | @click.option(
33 | "-e", "--email", prompt=True, callback=lambda _, __, value: validate_email(value)
34 | )
35 | @click.option(
36 | "-p",
37 | "--password",
38 | prompt=True,
39 | hide_input=True,
40 | confirmation_prompt=True,
41 | callback=lambda _, __, value: validate_password(value),
42 | )
43 | @click.option("--firstname", prompt=True)
44 | @click.option("--lastname", prompt=True)
45 | def account_register_cmd(username, email, password, firstname, lastname):
46 | client = AccountClient()
47 | client.registration(username, email, password, firstname, lastname)
48 | click.secho(
49 | "An account has been successfully created. "
50 | "Please check your mail to activate your account and verify your email address.",
51 | fg="green",
52 | )
53 |
--------------------------------------------------------------------------------
/platformio/debug/config/factory.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import importlib
16 | import re
17 |
18 | from platformio.debug.config.generic import GenericDebugConfig
19 | from platformio.debug.config.native import NativeDebugConfig
20 |
21 |
22 | class DebugConfigFactory:
23 | @staticmethod
24 | def get_clsname(name):
25 | name = re.sub(r"[^\da-z\_\-]+", "", name, flags=re.I)
26 | return "%sDebugConfig" % name.lower().capitalize()
27 |
28 | @classmethod
29 | def new(cls, platform, project_config, env_name):
30 | board_id = project_config.get("env:" + env_name, "board")
31 | config_cls = None
32 | tool_name = None
33 | if board_id:
34 | tool_name = platform.board_config(
35 | project_config.get("env:" + env_name, "board")
36 | ).get_debug_tool_name(project_config.get("env:" + env_name, "debug_tool"))
37 | try:
38 | mod = importlib.import_module("platformio.debug.config.%s" % tool_name)
39 | config_cls = getattr(mod, cls.get_clsname(tool_name))
40 | except ModuleNotFoundError:
41 | config_cls = (
42 | GenericDebugConfig if platform.is_embedded() else NativeDebugConfig
43 | )
44 | return config_cls(platform, project_config, env_name)
45 |
--------------------------------------------------------------------------------
/platformio/builder/tools/pioproject.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.compat import MISSING
16 | from platformio.project.config import ProjectConfig
17 |
18 |
19 | def GetProjectConfig(env):
20 | return ProjectConfig.get_instance(env["PROJECT_CONFIG"])
21 |
22 |
23 | def GetProjectOptions(env, as_dict=False):
24 | return env.GetProjectConfig().items(env=env["PIOENV"], as_dict=as_dict)
25 |
26 |
27 | def GetProjectOption(env, option, default=MISSING):
28 | return env.GetProjectConfig().get("env:" + env["PIOENV"], option, default)
29 |
30 |
31 | def LoadProjectOptions(env):
32 | config = env.GetProjectConfig()
33 | section = "env:" + env["PIOENV"]
34 | for option in config.options(section):
35 | option_meta = config.find_option_meta(section, option)
36 | if (
37 | not option_meta
38 | or not option_meta.buildenvvar
39 | or option_meta.buildenvvar in env
40 | ):
41 | continue
42 | env[option_meta.buildenvvar] = config.get(section, option)
43 |
44 |
45 | def exists(_):
46 | return True
47 |
48 |
49 | def generate(env):
50 | env.AddMethod(GetProjectConfig)
51 | env.AddMethod(GetProjectOptions)
52 | env.AddMethod(GetProjectOption)
53 | env.AddMethod(LoadProjectOptions)
54 | return env
55 |
--------------------------------------------------------------------------------
/tests/misc/test_misc.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-argument
16 |
17 | import pytest
18 | import requests
19 |
20 | from platformio import __check_internet_hosts__, http, proc
21 | from platformio.registry.client import RegistryClient
22 |
23 |
24 | def test_platformio_cli():
25 | result = proc.exec_command(["pio", "--help"])
26 | assert result["returncode"] == 0
27 | # pylint: disable=unsupported-membership-test
28 | assert "Usage: pio [OPTIONS] COMMAND [ARGS]..." in result["out"]
29 |
30 |
31 | def test_ping_internet_ips():
32 | for host in __check_internet_hosts__:
33 | requests.get("http://%s" % host, allow_redirects=False, timeout=2)
34 |
35 |
36 | def test_api_internet_offline(without_internet, isolated_pio_core):
37 | regclient = RegistryClient()
38 | with pytest.raises(http.InternetConnectionError):
39 | regclient.fetch_json_data("get", "/v3/search")
40 |
41 |
42 | def test_api_cache(monkeypatch, isolated_pio_core):
43 | regclient = RegistryClient()
44 | api_kwargs = {"method": "get", "path": "/v3/search", "x_cache_valid": "10s"}
45 | result = regclient.fetch_json_data(**api_kwargs)
46 | assert result and "total" in result
47 | monkeypatch.setattr(http, "_internet_on", lambda: False)
48 | assert regclient.fetch_json_data(**api_kwargs) == result
49 |
--------------------------------------------------------------------------------
/platformio/package/cli.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.package.commands.exec import package_exec_cmd
18 | from platformio.package.commands.install import package_install_cmd
19 | from platformio.package.commands.list import package_list_cmd
20 | from platformio.package.commands.outdated import package_outdated_cmd
21 | from platformio.package.commands.pack import package_pack_cmd
22 | from platformio.package.commands.publish import package_publish_cmd
23 | from platformio.package.commands.search import package_search_cmd
24 | from platformio.package.commands.show import package_show_cmd
25 | from platformio.package.commands.uninstall import package_uninstall_cmd
26 | from platformio.package.commands.unpublish import package_unpublish_cmd
27 | from platformio.package.commands.update import package_update_cmd
28 |
29 |
30 | @click.group(
31 | "pkg",
32 | commands=[
33 | package_exec_cmd,
34 | package_install_cmd,
35 | package_list_cmd,
36 | package_outdated_cmd,
37 | package_pack_cmd,
38 | package_publish_cmd,
39 | package_search_cmd,
40 | package_show_cmd,
41 | package_uninstall_cmd,
42 | package_unpublish_cmd,
43 | package_update_cmd,
44 | ],
45 | short_help="Unified Package Manager",
46 | )
47 | def cli():
48 | pass
49 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | What kind of issue is this?
2 |
3 | - [ ] **Question**.
4 | This issue tracker is not the place for questions. If you want to ask how to do something,
5 | or to understand why something isn't working the way you expect it to,
6 | use [Community Forums](https://community.platformio.org) or [Premium Support](https://platformio.org/support)
7 |
8 | - [ ] **PlatformIO IDE**.
9 | All issues related to PlatformIO IDE should be reported to the
10 | [PlatformIO IDE for VSCode](https://github.com/platformio/platformio-vscode-ide/issues) repository
11 |
12 | - [ ] **Development Platform or Board**.
13 | All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
14 | should be reported to appropriate repository related to your hardware
15 | https://github.com/topics/platformio-platform
16 |
17 | - [ ] **Feature Request**.
18 | Start by telling us what problem you’re trying to solve. Often a solution
19 | already exists! Don’t send pull requests to implement new features without first getting our
20 | support. Sometimes we leave features out on purpose to keep the project small.
21 |
22 | - [ ] **PlatformIO Core**.
23 | If you’ve found a bug, please provide an information below.
24 |
25 |
26 | *You can erase any parts of this template not applicable to your Issue.*
27 |
28 | ------------------------------------------------------------------
29 |
30 | ### Configuration
31 |
32 | **Operating system**:
33 |
34 | **PlatformIO Version** (`platformio --version`):
35 |
36 | ### Description of problem
37 |
38 |
39 | #### Steps to Reproduce
40 |
41 | 1.
42 | 2.
43 | 3.
44 |
45 | ### Actual Results
46 |
47 |
48 | ### Expected Results
49 |
50 |
51 | ### If problems with PlatformIO Build System:
52 |
53 | **The content of `platformio.ini`:**
54 | ```ini
55 | Insert here...
56 | ```
57 |
58 | **Source file to reproduce issue:**
59 | ```cpp
60 | Insert here...
61 | ```
62 |
63 | ### Additional info
64 |
--------------------------------------------------------------------------------
/platformio/account/org/commands/update.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_email, validate_orgname
19 |
20 |
21 | @click.command("update", short_help="Update organization")
22 | @click.argument("cur_orgname")
23 | @click.option(
24 | "--orgname",
25 | callback=lambda _, __, value: validate_orgname(value) if value else value,
26 | help="A new orgname",
27 | )
28 | @click.option(
29 | "--email",
30 | callback=lambda _, __, value: validate_email(value) if value else value,
31 | )
32 | @click.option("--displayname")
33 | def org_update_cmd(cur_orgname, **kwargs):
34 | client = AccountClient()
35 | org = client.get_org(cur_orgname)
36 | new_org = {
37 | key: value if value is not None else org[key] for key, value in kwargs.items()
38 | }
39 | if not any(kwargs.values()):
40 | for key in kwargs:
41 | new_org[key] = click.prompt(key.capitalize(), default=org[key])
42 | if key == "email":
43 | validate_email(new_org[key])
44 | if key == "orgname":
45 | validate_orgname(new_org[key])
46 | client.update_org(cur_orgname, new_org)
47 | return click.secho(
48 | "The organization `%s` has been successfully updated." % cur_orgname,
49 | fg="green",
50 | )
51 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/update.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient
18 | from platformio.account.validate import validate_orgname_teamname, validate_teamname
19 |
20 |
21 | @click.command("update", short_help="Update team")
22 | @click.argument(
23 | "orgname_teamname",
24 | metavar="ORGNAME:TEAMNAME",
25 | callback=lambda _, __, value: validate_orgname_teamname(value),
26 | )
27 | @click.option(
28 | "--name",
29 | callback=lambda _, __, value: validate_teamname(value) if value else value,
30 | help="A new team name",
31 | )
32 | @click.option(
33 | "--description",
34 | )
35 | def team_update_cmd(orgname_teamname, **kwargs):
36 | orgname, teamname = orgname_teamname.split(":", 1)
37 | client = AccountClient()
38 | team = client.get_team(orgname, teamname)
39 | new_team = {
40 | key: value if value is not None else team[key] for key, value in kwargs.items()
41 | }
42 | if not any(kwargs.values()):
43 | for key in kwargs:
44 | new_team[key] = click.prompt(key.capitalize(), default=team[key])
45 | if key == "name":
46 | validate_teamname(new_team[key])
47 | client.update_team(orgname, teamname, new_team)
48 | return click.secho(
49 | "The team %s has been successfully updated." % teamname,
50 | fg="green",
51 | )
52 |
--------------------------------------------------------------------------------
/tests/misc/ino2cpp/test_ino2cpp.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from os import listdir
16 | from os.path import dirname, isdir, join, normpath
17 |
18 | from platformio.commands.ci import cli as cmd_ci
19 |
20 | EXAMPLES_DIR = normpath(join(dirname(__file__), "examples"))
21 |
22 |
23 | def pytest_generate_tests(metafunc):
24 | if "piotest_dir" not in metafunc.fixturenames:
25 | return
26 | test_dirs = []
27 | for name in listdir(EXAMPLES_DIR):
28 | if isdir(join(EXAMPLES_DIR, name)):
29 | test_dirs.append(join(EXAMPLES_DIR, name))
30 | test_dirs.sort()
31 | metafunc.parametrize("piotest_dir", test_dirs)
32 |
33 |
34 | def test_example(clirunner, validate_cliresult, piotest_dir):
35 | result = clirunner.invoke(cmd_ci, [piotest_dir, "-b", "uno"])
36 | validate_cliresult(result)
37 |
38 |
39 | def test_warning_line(clirunner, validate_cliresult):
40 | result = clirunner.invoke(cmd_ci, [join(EXAMPLES_DIR, "basic"), "-b", "uno"])
41 | validate_cliresult(result)
42 | assert 'basic.ino:16:14: warning: #warning "Line number is 16"' in result.output
43 | assert 'basic.ino:46:2: warning: #warning "Line number is 46"' in result.output
44 | result = clirunner.invoke(
45 | cmd_ci, [join(EXAMPLES_DIR, "strmultilines"), "-b", "uno"]
46 | )
47 | validate_cliresult(result)
48 | assert 'main.ino:75:2: warning: #warning "Line 75"' in result.output
49 |
--------------------------------------------------------------------------------
/platformio/package/version.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import re
16 |
17 | import semantic_version
18 |
19 | from platformio.exception import UserSideException
20 |
21 |
22 | class SemanticVersionError(UserSideException):
23 | pass
24 |
25 |
26 | def cast_version_to_semver(value, force=True, raise_exception=False):
27 | assert value
28 | try:
29 | return semantic_version.Version(value)
30 | except ValueError:
31 | pass
32 | if force:
33 | try:
34 | return semantic_version.Version.coerce(value)
35 | except ValueError:
36 | pass
37 | if raise_exception:
38 | raise SemanticVersionError("Invalid SemVer version %s" % value)
39 | # parse commit hash
40 | if re.match(r"^[\da-f]+$", value, flags=re.I):
41 | return semantic_version.Version("0.0.0+sha." + value)
42 | return semantic_version.Version("0.0.0+" + value)
43 |
44 |
45 | def pepver_to_semver(pepver):
46 | return cast_version_to_semver(
47 | re.sub(r"(\.\d+)\.?(dev|a|b|rc|post)", r"\1-\2.", pepver, count=1)
48 | )
49 |
50 |
51 | def get_original_version(version):
52 | if version.count(".") != 2:
53 | return None
54 | _, raw = version.split(".")[:2]
55 | if int(raw) <= 99:
56 | return None
57 | if int(raw) <= 9999:
58 | return "%s.%s" % (raw[:-2], int(raw[-2:]))
59 | return "%s.%s.%s" % (raw[:-4], int(raw[-4:-2]), int(raw[-2:]))
60 |
--------------------------------------------------------------------------------
/platformio/project/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.exception import PlatformioException, UserSideException
16 |
17 |
18 | class ProjectError(PlatformioException):
19 | pass
20 |
21 |
22 | class NotPlatformIOProjectError(ProjectError, UserSideException):
23 | MESSAGE = (
24 | "Not a PlatformIO project. `platformio.ini` file has not been "
25 | "found in current working directory ({0}). To initialize new project "
26 | "please use `platformio project init` command"
27 | )
28 |
29 |
30 | class InvalidProjectConfError(ProjectError, UserSideException):
31 | MESSAGE = "Invalid '{0}' (project configuration file): '{1}'"
32 |
33 |
34 | class UndefinedEnvPlatformError(ProjectError, UserSideException):
35 | MESSAGE = "Please specify platform for '{0}' environment"
36 |
37 |
38 | class ProjectEnvsNotAvailableError(ProjectError, UserSideException):
39 | MESSAGE = "Please setup environments in `platformio.ini` file"
40 |
41 |
42 | class UnknownEnvNamesError(ProjectError, UserSideException):
43 | MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'"
44 |
45 |
46 | class InvalidEnvNameError(ProjectError, UserSideException):
47 | MESSAGE = (
48 | "Invalid environment name '{0}'. The name can contain "
49 | "alphanumeric, underscore, and hyphen characters (a-z, 0-9, -, _)"
50 | )
51 |
52 |
53 | class ProjectOptionValueError(ProjectError, UserSideException):
54 | pass
55 |
--------------------------------------------------------------------------------
/tests/misc/test_maintenance.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-argument
16 |
17 | from time import time
18 |
19 | from platformio import app, maintenance
20 | from platformio.__main__ import cli as cli_pio
21 | from platformio.commands import upgrade as cmd_upgrade
22 |
23 |
24 | def test_check_pio_upgrade(clirunner, isolated_pio_core, validate_cliresult):
25 | def _patch_pio_version(version):
26 | maintenance.__version__ = version
27 | cmd_upgrade.VERSION = version.split(".", 3)
28 |
29 | interval = int(app.get_setting("check_platformio_interval")) * 3600 * 24
30 | last_check = {"platformio_upgrade": time() - interval - 1}
31 | origin_version = maintenance.__version__
32 |
33 | # check development version
34 | _patch_pio_version("3.0.0-a1")
35 | app.set_state_item("last_check", last_check)
36 | result = clirunner.invoke(cli_pio, ["platform", "list"])
37 | validate_cliresult(result)
38 | assert "There is a new version" in result.output
39 | assert "Please upgrade" in result.output
40 |
41 | # check stable version
42 | _patch_pio_version("2.11.0")
43 | app.set_state_item("last_check", last_check)
44 | result = clirunner.invoke(cli_pio, ["platform", "list"])
45 | validate_cliresult(result)
46 | assert "There is a new version" in result.output
47 | assert "Please upgrade" in result.output
48 |
49 | # restore original version
50 | _patch_pio_version(origin_version)
51 |
--------------------------------------------------------------------------------
/tests/commands/pkg/test_search.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.package.commands.search import package_search_cmd
16 |
17 |
18 | def test_empty_query(clirunner, validate_cliresult):
19 | result = clirunner.invoke(
20 | package_search_cmd,
21 | [""],
22 | )
23 | validate_cliresult(result)
24 | assert all(t in result.output for t in ("Found", "Official", "page 1 of"))
25 |
26 |
27 | def test_pagination(clirunner, validate_cliresult):
28 | result = clirunner.invoke(
29 | package_search_cmd,
30 | ["type:tool"],
31 | )
32 | validate_cliresult(result)
33 | assert all(t in result.output for t in ("Verified Tool", "page 1 of"))
34 |
35 | result = clirunner.invoke(
36 | package_search_cmd,
37 | ["type:tool", "-p", "10"],
38 | )
39 | validate_cliresult(result)
40 | assert all(t in result.output for t in ("Tool", "page 10 of"))
41 |
42 |
43 | def test_sorting(clirunner, validate_cliresult):
44 | result = clirunner.invoke(
45 | package_search_cmd,
46 | ["OneWire", "-s", "popularity"],
47 | )
48 | validate_cliresult(result)
49 | assert "paulstoffregen/OneWire" in result.output
50 |
51 |
52 | def test_not_found(clirunner, validate_cliresult):
53 | result = clirunner.invoke(
54 | package_search_cmd,
55 | ["name:unknown-package"],
56 | )
57 | validate_cliresult(result)
58 | assert "Nothing has been found" in result.output
59 |
--------------------------------------------------------------------------------
/tests/commands/test_boards.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | from platformio.commands.boards import cli as cmd_boards
18 | from platformio.commands.platform import platform_search as cmd_platform_search
19 |
20 |
21 | def test_board_json_output(clirunner, validate_cliresult):
22 | result = clirunner.invoke(cmd_boards, ["mbed", "--json-output"])
23 | validate_cliresult(result)
24 | boards = json.loads(result.output)
25 | assert isinstance(boards, list)
26 | assert any("mbed" in b["frameworks"] for b in boards)
27 |
28 |
29 | def test_board_raw_output(clirunner, validate_cliresult):
30 | result = clirunner.invoke(cmd_boards, ["espidf"])
31 | validate_cliresult(result)
32 | assert "espressif32" in result.output
33 |
34 |
35 | def test_board_options(clirunner, validate_cliresult):
36 | required_opts = set(["fcpu", "frameworks", "id", "mcu", "name", "platform"])
37 |
38 | # fetch available platforms
39 | result = clirunner.invoke(cmd_platform_search, ["--json-output"])
40 | validate_cliresult(result)
41 | search_result = json.loads(result.output)
42 | assert isinstance(search_result, list)
43 | assert search_result
44 | platforms = [item["name"] for item in search_result]
45 |
46 | result = clirunner.invoke(cmd_boards, ["mbed", "--json-output"])
47 | validate_cliresult(result)
48 | boards = json.loads(result.output)
49 |
50 | for board in boards:
51 | assert required_opts.issubset(set(board))
52 | assert board["platform"] in platforms
53 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | [isort]
16 | profile = black
17 | known_third_party=OpenSSL, SCons, jsonrpc, twisted, zope
18 |
19 | [pytest]
20 | filterwarnings =
21 | error
22 | # Bottle
23 | ignore:.*'cgi' is deprecated and slated for removal
24 | ignore:'protected_args' is deprecated and will be removed in Click 9.0:DeprecationWarning
25 |
26 |
27 | [testenv]
28 | passenv = *
29 | usedevelop = True
30 | deps =
31 | black
32 | codespell
33 | isort
34 | jsondiff
35 | pylint
36 | pytest
37 | pytest-xdist
38 | commands =
39 | {envpython} --version
40 | pio system info
41 |
42 | [testenv:lint]
43 | commands =
44 | {envpython} --version
45 | pylint --rcfile=./.pylintrc ./platformio
46 | pylint --rcfile=./.pylintrc ./tests
47 |
48 | [testenv:testcore]
49 | commands =
50 | {envpython} --version
51 | py.test -v --basetemp={envtmpdir} -k "not skip_ci" tests --ignore tests/test_examples.py
52 |
53 | [testenv:testexamples]
54 | commands =
55 | {envpython} scripts/install_devplatforms.py
56 | py.test -v --basetemp={envtmpdir} tests/test_examples.py
57 |
58 | [testenv:docs]
59 | deps =
60 | sphinx-rtd-theme==3.0.2
61 | sphinxcontrib-googleanalytics
62 | sphinx-notfound-page
63 | sphinx-copybutton
64 | restructuredtext-lint
65 | change_dir = docs
66 | commands =
67 | sphinx-build -b html . _build/html
68 |
69 | [testenv:docslinkcheck]
70 | deps =
71 | {[testenv:docs]deps}
72 | change_dir = docs
73 | commands =
74 | sphinx-build -b linkcheck . _build
75 |
--------------------------------------------------------------------------------
/platformio/home/rpc/handlers/misc.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 | import time
17 |
18 | from platformio.cache import ContentCache
19 | from platformio.compat import aio_create_task
20 | from platformio.home.rpc.handlers.base import BaseRPCHandler
21 | from platformio.home.rpc.handlers.os import OSRPC
22 |
23 |
24 | class MiscRPC(BaseRPCHandler):
25 | async def load_latest_tweets(self, data_url):
26 | cache_key = ContentCache.key_from_args(data_url, "tweets")
27 | cache_valid = "180d"
28 | with ContentCache() as cc:
29 | cache_data = cc.get(cache_key)
30 | if cache_data:
31 | cache_data = json.loads(cache_data)
32 | # automatically update cache in background every 12 hours
33 | if cache_data["time"] < (time.time() - (3600 * 12)):
34 | aio_create_task(
35 | self._preload_latest_tweets(data_url, cache_key, cache_valid)
36 | )
37 | return cache_data["result"]
38 |
39 | return await self._preload_latest_tweets(data_url, cache_key, cache_valid)
40 |
41 | @staticmethod
42 | async def _preload_latest_tweets(data_url, cache_key, cache_valid):
43 | result = json.loads((await OSRPC.fetch_content(data_url)))
44 | with ContentCache() as cc:
45 | cc.set(
46 | cache_key,
47 | json.dumps({"time": int(time.time()), "result": result}),
48 | cache_valid,
49 | )
50 | return result
51 |
--------------------------------------------------------------------------------
/.github/workflows/examples.yml:
--------------------------------------------------------------------------------
1 | name: Examples
2 |
3 | on: [push, pull_request]
4 |
5 |
6 | jobs:
7 | build:
8 | strategy:
9 | fail-fast: false
10 | matrix:
11 | os: [ubuntu-latest, windows-latest, macos-latest]
12 | runs-on: ${{ matrix.os }}
13 | env:
14 | PIO_INSTALL_DEVPLATFORM_OWNERNAMES: "platformio"
15 | PIO_INSTALL_DEVPLATFORM_NAMES: "aceinna_imu,atmelavr,atmelmegaavr,atmelsam,espressif32,espressif8266,nordicnrf52,raspberrypi,ststm32,teensy"
16 |
17 | steps:
18 | - uses: actions/checkout@v4
19 | with:
20 | submodules: "recursive"
21 |
22 | - name: Set up Python
23 | uses: actions/setup-python@v4
24 | with:
25 | python-version: "3.11"
26 |
27 | - name: Install dependencies
28 | run: |
29 | python -m pip install --upgrade pip
30 | pip install tox
31 |
32 | - name: Run on Linux
33 | if: startsWith(matrix.os, 'ubuntu')
34 | run: |
35 | # Free space
36 | echo "Listing 50 largest packages"
37 | dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 50
38 | df -h
39 | sudo rm -rf /opt/hostedtoolcache
40 | sudo rm -rf /usr/share/dotnet
41 | sudo rm -rf /usr/local/lib/android
42 | sudo apt clean
43 | docker system prune -af
44 | df -h
45 |
46 | tox -e testexamples
47 |
48 | - name: Run on macOS
49 | if: startsWith(matrix.os, 'macos')
50 | run: |
51 | df -h
52 | tox -e testexamples
53 |
54 | - name: Run on Windows
55 | if: startsWith(matrix.os, 'windows')
56 | env:
57 | PLATFORMIO_CORE_DIR: C:/pio
58 | PLATFORMIO_WORKSPACE_DIR: C:/pio-workspace/$PROJECT_HASH
59 | run: |
60 | tox -e testexamples
61 |
62 | - name: Slack Notification
63 | uses: homoluctus/slatify@master
64 | if: failure()
65 | with:
66 | type: ${{ job.status }}
67 | job_name: '*Examples*'
68 | commit: true
69 | url: ${{ secrets.SLACK_BUILD_WEBHOOK }}
70 | token: ${{ secrets.SLACK_GITHUB_TOKEN }}
71 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported Versions
4 |
5 | We are committed to ensuring the security and protection of PlatformIO Core.
6 | To this end, we support only the following versions:
7 |
8 | | Version | Supported |
9 | | ------- | ------------------ |
10 | | 6.1.x | :white_check_mark: |
11 | | < 6.1 | :x: |
12 |
13 | Unsupported versions of the PlatformIO Core may have known vulnerabilities or security issues that could compromise the security of our organization's systems and data.
14 | Therefore, it is important that all developers use only supported versions of the PlatformIO Core.
15 |
16 | ## Reporting a Vulnerability
17 |
18 | We take the security of our systems and data very seriously. We encourage responsible disclosure of any vulnerabilities or security issues that you may find in our systems or applications. If you believe you have discovered a vulnerability, please report it to us immediately.
19 |
20 | To report a vulnerability, please send an email to our security team at contact@piolabs.com. Please include as much information as possible, including:
21 |
22 | - A description of the vulnerability and how it can be exploited
23 | - Steps to reproduce the vulnerability
24 | - Any additional information that can help us understand and reproduce the vulnerability
25 |
26 | Once we receive your report, our security team will acknowledge receipt within 24 hours and will work to validate the reported vulnerability. We will provide periodic updates on the progress of the vulnerability assessment, and will notify you once a fix has been deployed.
27 |
28 | If the vulnerability is accepted, we will work to remediate the issue as quickly as possible. We may also provide credit or recognition to the individual who reported the vulnerability, at our discretion.
29 |
30 | If the vulnerability is declined, we will provide a justification for our decision and may offer guidance on how to improve the report or how to test the system more effectively.
31 |
32 | Please note that we will not take any legal action against individuals who report vulnerabilities in good faith and in accordance with this policy.
33 |
34 | Thank you for helping us keep our systems and data secure.
35 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/netbeans/nbproject/private/launcher.properties.tpl:
--------------------------------------------------------------------------------
1 | # Launchers File syntax:
2 | #
3 | # [Must-have property line]
4 | # launcher1.runCommand=
5 | # [Optional extra properties]
6 | # launcher1.displayName=
7 | # launcher1.buildCommand=
8 | # launcher1.runDir=
9 | # launcher1.symbolFiles=
10 | # launcher1.env.=
11 | # (If this value is quoted with ` it is handled as a native command which execution result will become the value)
12 | # [Common launcher properties]
13 | # common.runDir=
14 | # (This value is overwritten by a launcher specific runDir value if the latter exists)
15 | # common.env.=
16 | # (Environment variables from common launcher are merged with launcher specific variables)
17 | # common.symbolFiles=
18 | # (This value is overwritten by a launcher specific symbolFiles value if the latter exists)
19 | #
20 | # In runDir, symbolFiles and env fields you can use these macros:
21 | # ${PROJECT_DIR} - project directory absolute path
22 | # ${OUTPUT_PATH} - linker output path (relative to project directory path)
23 | # ${OUTPUT_BASENAME}- linker output filename
24 | # ${TESTDIR} - test files directory (relative to project directory path)
25 | # ${OBJECTDIR} - object files directory (relative to project directory path)
26 | # ${CND_DISTDIR} - distribution directory (relative to project directory path)
27 | # ${CND_BUILDDIR} - build directory (relative to project directory path)
28 | # ${CND_PLATFORM} - platform name
29 | # ${CND_CONF} - configuration name
30 | # ${CND_DLIB_EXT} - dynamic library extension
31 | #
32 | # All the project launchers must be listed in the file!
33 | #
34 | # launcher1.runCommand=...
35 | # launcher2.runCommand=...
36 | # ...
37 | # common.runDir=...
38 | # common.env.KEY=VALUE
39 |
40 | # launcher1.runCommand=
--------------------------------------------------------------------------------
/scripts/install_devplatforms.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 | import subprocess
17 | import sys
18 |
19 | import click
20 |
21 |
22 | @click.command()
23 | @click.option("--desktop", is_flag=True, default=False)
24 | @click.option(
25 | "--names",
26 | envvar="PIO_INSTALL_DEVPLATFORM_NAMES",
27 | help="Install specified platform (split by comma)",
28 | )
29 | @click.option(
30 | "--ownernames",
31 | envvar="PIO_INSTALL_DEVPLATFORM_OWNERNAMES",
32 | help="Filter by ownernames (split by comma)",
33 | )
34 | def main(desktop, names, ownernames):
35 | platforms = json.loads(
36 | subprocess.check_output(["pio", "platform", "search", "--json-output"]).decode()
37 | )
38 | names = [n.strip() for n in (names or "").split(",") if n.strip()]
39 | ownernames = [n.strip() for n in (ownernames or "").split(",") if n.strip()]
40 | for platform in platforms:
41 | skip = [
42 | not desktop and platform["forDesktop"],
43 | names and platform["name"] not in names,
44 | ownernames and platform["ownername"] not in ownernames,
45 | ]
46 | if any(skip):
47 | continue
48 | subprocess.check_call(
49 | [
50 | "pio",
51 | "pkg",
52 | "install",
53 | "--global",
54 | "--skip-dependencies",
55 | "--platform",
56 | "{ownername}/{name}".format(**platform),
57 | ]
58 | )
59 |
60 |
61 | if __name__ == "__main__":
62 | sys.exit(main())
63 |
--------------------------------------------------------------------------------
/platformio/remote/client/device_list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | import click
18 |
19 | from platformio.remote.client.base import RemoteClientBase
20 |
21 |
22 | class DeviceListClient(RemoteClientBase):
23 | def __init__(self, agents, json_output):
24 | RemoteClientBase.__init__(self)
25 | self.agents = agents
26 | self.json_output = json_output
27 |
28 | def agent_pool_ready(self):
29 | d = self.agentpool.callRemote("cmd", self.agents, "device.list")
30 | d.addCallback(self._cbResult)
31 | d.addErrback(self.cb_global_error)
32 |
33 | def _cbResult(self, result):
34 | data = {}
35 | for success, value in result:
36 | if not success:
37 | click.secho(value, fg="red", err=True)
38 | continue
39 | (agent_name, devlist) = value
40 | data[agent_name] = devlist
41 |
42 | if self.json_output:
43 | click.echo(json.dumps(data))
44 | else:
45 | for agent_name, devlist in data.items():
46 | click.echo("Agent %s" % click.style(agent_name, fg="cyan", bold=True))
47 | click.echo("=" * (6 + len(agent_name)))
48 | for item in devlist:
49 | click.secho(item["port"], fg="cyan")
50 | click.echo("-" * len(item["port"]))
51 | click.echo("Hardware ID: %s" % item["hwid"])
52 | click.echo("Description: %s" % item["description"])
53 | click.echo("")
54 | self.disconnect()
55 |
--------------------------------------------------------------------------------
/tests/commands/pkg/test_exec.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-argument
16 |
17 | import pytest
18 |
19 | from platformio.package.commands.exec import package_exec_cmd
20 | from platformio.util import strip_ansi_codes
21 |
22 |
23 | def test_pkg_not_installed(clirunner, validate_cliresult, isolated_pio_core):
24 | result = clirunner.invoke(
25 | package_exec_cmd,
26 | ["--", "openocd"],
27 | )
28 | with pytest.raises(
29 | AssertionError,
30 | match=("Could not find a package with 'openocd' executable file"),
31 | ):
32 | validate_cliresult(result)
33 |
34 |
35 | def test_pkg_specified(clirunner, validate_cliresult, isolated_pio_core):
36 | # with install
37 | result = clirunner.invoke(
38 | package_exec_cmd,
39 | ["-p", "platformio/tool-openocd", "--", "openocd", "--version"],
40 | obj=dict(force_click_stream=True),
41 | )
42 | validate_cliresult(result)
43 | output = strip_ansi_codes(result.output)
44 | assert "Tool Manager: Installing platformio/tool-openocd" in output
45 | assert "Open On-Chip Debugger" in output
46 |
47 |
48 | def test_unrecognized_options(clirunner, validate_cliresult, isolated_pio_core):
49 | # unrecognized option
50 | result = clirunner.invoke(
51 | package_exec_cmd,
52 | ["--", "openocd", "--test-unrecognized"],
53 | obj=dict(force_click_stream=True),
54 | )
55 | with pytest.raises(
56 | AssertionError,
57 | match=(r"openocd: (unrecognized|unknown) option"),
58 | ):
59 | validate_cliresult(result)
60 |
--------------------------------------------------------------------------------
/tests/commands/pkg/test_outdated.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | # pylint: disable=unused-argument
16 |
17 | import re
18 |
19 | from platformio.package.commands.install import package_install_cmd
20 | from platformio.package.commands.outdated import package_outdated_cmd
21 |
22 | PROJECT_OUTDATED_CONFIG_TPL = """
23 | [env:devkit]
24 | platform = platformio/atmelavr@^2
25 | framework = arduino
26 | board = attiny88
27 | lib_deps = milesburton/DallasTemperature@~3.9.0
28 | """
29 |
30 | PROJECT_UPDATED_CONFIG_TPL = """
31 | [env:devkit]
32 | platform = platformio/atmelavr@<4
33 | framework = arduino
34 | board = attiny88
35 | lib_deps = milesburton/DallasTemperature@^3.9.0
36 | """
37 |
38 |
39 | def test_project(clirunner, validate_cliresult, isolated_pio_core, tmp_path):
40 | project_dir = tmp_path / "project"
41 | project_dir.mkdir()
42 | (project_dir / "platformio.ini").write_text(PROJECT_OUTDATED_CONFIG_TPL)
43 | result = clirunner.invoke(package_install_cmd, ["-d", str(project_dir)])
44 | validate_cliresult(result)
45 |
46 | # overwrite config
47 | (project_dir / "platformio.ini").write_text(PROJECT_UPDATED_CONFIG_TPL)
48 | result = clirunner.invoke(package_outdated_cmd, ["-d", str(project_dir)])
49 | validate_cliresult(result)
50 |
51 | # validate output
52 | assert "Checking" in result.output
53 | assert re.search(
54 | r"^atmelavr\s+2\.2\.0\s+3\.\d+\.\d+\s+[456789]\.\d+\.\d+\s+Platform\s+devkit",
55 | result.output,
56 | re.MULTILINE,
57 | )
58 | assert re.search(
59 | r"^DallasTemperature\s+3\.\d\.1\s+3\.\d+\.\d+\s+4\.\d+\.\d+\s+Library\s+devkit",
60 | result.output,
61 | re.MULTILINE,
62 | )
63 |
--------------------------------------------------------------------------------
/platformio/package/exception.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio import util
16 | from platformio.exception import UserSideException
17 |
18 |
19 | class PackageException(UserSideException):
20 | pass
21 |
22 |
23 | class ManifestException(PackageException):
24 | pass
25 |
26 |
27 | class UnknownManifestError(ManifestException):
28 | pass
29 |
30 |
31 | class ManifestParserError(ManifestException):
32 | pass
33 |
34 |
35 | class ManifestValidationError(ManifestException):
36 | def __init__(self, messages, data, valid_data):
37 | super().__init__()
38 | self.messages = messages
39 | self.data = data
40 | self.valid_data = valid_data
41 |
42 | def __str__(self):
43 | return (
44 | "Invalid manifest fields: %s. \nPlease check specification -> "
45 | "https://docs.platformio.org/page/librarymanager/config.html"
46 | % self.messages
47 | )
48 |
49 |
50 | class MissingPackageManifestError(ManifestException):
51 | MESSAGE = "Could not find one of '{0}' manifest files in the package"
52 |
53 |
54 | class UnknownPackageError(PackageException):
55 | MESSAGE = (
56 | "Could not find the package with '{0}' requirements for your system '%s'"
57 | % util.get_systype()
58 | )
59 |
60 |
61 | class NotGlobalLibDir(PackageException):
62 | MESSAGE = (
63 | "The `{0}` is not a PlatformIO project.\n\n"
64 | "To manage libraries in global storage `{1}`,\n"
65 | "please use `platformio lib --global {2}` or specify custom storage "
66 | "`platformio lib --storage-dir /path/to/storage/ {2}`.\n"
67 | "Check `platformio lib --help` for details."
68 | )
69 |
--------------------------------------------------------------------------------
/platformio/remote/ac/serial.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from time import sleep
16 |
17 | from twisted.internet import protocol, reactor # pylint: disable=import-error
18 | from twisted.internet.serialport import SerialPort # pylint: disable=import-error
19 |
20 | from platformio.remote.ac.base import AsyncCommandBase
21 |
22 |
23 | class SerialPortAsyncCmd(protocol.Protocol, AsyncCommandBase):
24 | def start(self):
25 | SerialPort(
26 | self,
27 | reactor=reactor,
28 | **{
29 | "deviceNameOrPortNumber": self.options["port"],
30 | "baudrate": self.options["baud"],
31 | "parity": self.options["parity"],
32 | "rtscts": 1 if self.options["rtscts"] else 0,
33 | "xonxoff": 1 if self.options["xonxoff"] else 0,
34 | }
35 | )
36 |
37 | def connectionMade(self):
38 | self.reset_device()
39 | if self.options.get("rts", None) is not None:
40 | self.transport.setRTS(self.options.get("rts"))
41 | if self.options.get("dtr", None) is not None:
42 | self.transport.setDTR(self.options.get("dtr"))
43 |
44 | def reset_device(self):
45 | self.transport.flushInput()
46 | self.transport.setDTR(False)
47 | self.transport.setRTS(False)
48 | sleep(0.1)
49 | self.transport.setDTR(True)
50 | self.transport.setRTS(True)
51 | sleep(0.1)
52 |
53 | def dataReceived(self, data):
54 | self._ac_ondata(data)
55 |
56 | def connectionLost(self, reason): # pylint: disable=unused-argument
57 | if self._paused:
58 | return
59 | self._return_code = 0
60 | self._ac_ended()
61 |
--------------------------------------------------------------------------------
/platformio/builder/tools/piotest.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 |
17 | from platformio.builder.tools import piobuild
18 | from platformio.test.result import TestSuite
19 | from platformio.test.runners.factory import TestRunnerFactory
20 |
21 |
22 | def ConfigureTestTarget(env):
23 | env.Append(
24 | CPPDEFINES=["UNIT_TEST"], # deprecated, use PIO_UNIT_TESTING
25 | PIOTEST_SRC_FILTER=[f"+<*.{ext}>" for ext in piobuild.SRC_BUILD_EXT],
26 | )
27 | env.Prepend(CPPPATH=["$PROJECT_TEST_DIR"])
28 |
29 | if "PIOTEST_RUNNING_NAME" in env:
30 | test_name = env["PIOTEST_RUNNING_NAME"]
31 | while True:
32 | test_name = os.path.dirname(test_name) # parent dir
33 | # skip nested tests (user's side issue?)
34 | if not test_name or os.path.basename(test_name).startswith("test_"):
35 | break
36 | env.Prepend(
37 | PIOTEST_SRC_FILTER=[
38 | f"+<{test_name}{os.path.sep}*.{ext}>"
39 | for ext in piobuild.SRC_BUILD_EXT
40 | ],
41 | CPPPATH=[os.path.join("$PROJECT_TEST_DIR", test_name)],
42 | )
43 |
44 | env.Prepend(
45 | PIOTEST_SRC_FILTER=[f"+<$PIOTEST_RUNNING_NAME{os.path.sep}>"],
46 | CPPPATH=[os.path.join("$PROJECT_TEST_DIR", "$PIOTEST_RUNNING_NAME")],
47 | )
48 |
49 | test_runner = TestRunnerFactory.new(
50 | TestSuite(env["PIOENV"], env.get("PIOTEST_RUNNING_NAME", "*")),
51 | env.GetProjectConfig(),
52 | )
53 | test_runner.configure_build_env(env)
54 |
55 |
56 | def generate(env):
57 | env.AddMethod(ConfigureTestTarget)
58 |
59 |
60 | def exists(_):
61 | return True
62 |
--------------------------------------------------------------------------------
/platformio/debug/config/blackmagic.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.debug.config.base import DebugConfigBase
16 | from platformio.debug.exception import DebugInvalidOptionsError
17 | from platformio.device.finder import SerialPortFinder, is_pattern_port
18 |
19 |
20 | class BlackmagicDebugConfig(DebugConfigBase):
21 | GDB_INIT_SCRIPT = """
22 | define pio_reset_halt_target
23 | set language c
24 | set *0xE000ED0C = 0x05FA0004
25 | set $busy = (*0xE000ED0C & 0x4)
26 | while ($busy)
27 | set $busy = (*0xE000ED0C & 0x4)
28 | end
29 | set language auto
30 | end
31 |
32 | define pio_reset_run_target
33 | pio_reset_halt_target
34 | end
35 |
36 | target extended-remote $DEBUG_PORT
37 | monitor swdp_scan
38 | attach 1
39 | set mem inaccessible-by-default off
40 | $LOAD_CMDS
41 | $INIT_BREAK
42 |
43 | set language c
44 | set *0xE000ED0C = 0x05FA0004
45 | set $busy = (*0xE000ED0C & 0x4)
46 | while ($busy)
47 | set $busy = (*0xE000ED0C & 0x4)
48 | end
49 | set language auto
50 | """
51 |
52 | @property
53 | def port(self):
54 | # pylint: disable=assignment-from-no-return
55 | initial_port = DebugConfigBase.port.fget(self)
56 | if initial_port and not is_pattern_port(initial_port):
57 | return initial_port
58 | port = SerialPortFinder(
59 | board_config=self.board_config,
60 | upload_protocol=self.tool_name,
61 | prefer_gdb_port=True,
62 | ).find(initial_port)
63 | if port:
64 | return port
65 | raise DebugInvalidOptionsError(
66 | "Please specify `debug_port` for the working environment"
67 | )
68 |
69 | @port.setter
70 | def port(self, value):
71 | self._port = value
72 |
--------------------------------------------------------------------------------
/tests/project/test_metadata.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | from platformio.project.commands.metadata import project_metadata_cmd
18 |
19 |
20 | def test_metadata_dump(clirunner, validate_cliresult, tmpdir):
21 | tmpdir.join("platformio.ini").write(
22 | """
23 | [env:native]
24 | platform = native
25 | """
26 | )
27 |
28 | component_dir = tmpdir.mkdir("lib").mkdir("component")
29 | component_dir.join("library.json").write(
30 | """
31 | {
32 | "name": "component",
33 | "version": "1.0.0"
34 | }
35 | """
36 | )
37 | component_dir.mkdir("include").join("component.h").write(
38 | """
39 | #define I_AM_COMPONENT
40 |
41 | void dummy(void);
42 | """
43 | )
44 | component_dir.mkdir("src").join("component.cpp").write(
45 | """
46 | #include
47 |
48 | void dummy(void ) {};
49 | """
50 | )
51 |
52 | tmpdir.mkdir("src").join("main.c").write(
53 | """
54 | #include
55 |
56 | #ifndef I_AM_COMPONENT
57 | #error "I_AM_COMPONENT"
58 | #endif
59 |
60 | int main() {
61 | }
62 | """
63 | )
64 |
65 | metadata_path = tmpdir.join("metadata.json")
66 | result = clirunner.invoke(
67 | project_metadata_cmd,
68 | [
69 | "--project-dir",
70 | str(tmpdir),
71 | "-e",
72 | "native",
73 | "--json-output",
74 | "--json-output-path",
75 | str(metadata_path),
76 | ],
77 | )
78 | validate_cliresult(result)
79 | with open(str(metadata_path), encoding="utf8") as fp:
80 | metadata = json.load(fp)["native"]
81 | assert len(metadata["includes"]["build"]) == 3
82 | assert len(metadata["includes"]["compatlib"]) == 2
83 |
--------------------------------------------------------------------------------
/platformio/dependencies.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from platformio.compat import is_proxy_set
16 |
17 |
18 | def get_core_dependencies():
19 | return {
20 | "contrib-piohome": "~3.4.2",
21 | "contrib-pioremote": "~1.0.0",
22 | "tool-scons": "~4.40801.0",
23 | "tool-cppcheck": "~1.21100.0",
24 | "tool-clangtidy": "~1.150005.0",
25 | "tool-pvs-studio": "~7.18.0",
26 | }
27 |
28 |
29 | def get_pip_dependencies():
30 | core = [
31 | "bottle == 0.13.*",
32 | "click >=8.0.4, <8.4", # click 9.0 removes 'protected_args' attribute
33 | "colorama",
34 | "marshmallow == 3.*",
35 | "pyelftools >=0.27, <1",
36 | "pyserial == 3.5.*", # keep in sync "device/monitor/terminal.py"
37 | "requests%s == 2.*" % ("[socks]" if is_proxy_set(socks=True) else ""),
38 | "semantic_version == 2.10.*",
39 | "tabulate == 0.*",
40 | ]
41 |
42 | home = [
43 | # PIO Home requirements
44 | "ajsonrpc == 1.2.*",
45 | "starlette >=0.19, <0.51",
46 | "uvicorn >=0.16, <0.39",
47 | "wsproto == 1.*",
48 | ]
49 |
50 | extra = []
51 | # issue #4702; Broken "requests/charset_normalizer" on macOS ARM
52 | extra.append(
53 | 'chardet >= 3.0.2,<6; platform_system == "Darwin" and "arm" in platform_machine'
54 | )
55 |
56 | # issue 4614: urllib3 v2.0 only supports OpenSSL 1.1.1+
57 | try:
58 | import ssl # pylint: disable=import-outside-toplevel
59 |
60 | if ssl.OPENSSL_VERSION.startswith("OpenSSL ") and ssl.OPENSSL_VERSION_INFO < (
61 | 1,
62 | 1,
63 | 1,
64 | ):
65 | extra.append("urllib3<2")
66 | except ImportError:
67 | pass
68 |
69 | return core + home + extra
70 |
--------------------------------------------------------------------------------
/platformio/registry/access/commands/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | import click
18 | from tabulate import tabulate
19 |
20 | from platformio.registry.client import RegistryClient
21 |
22 |
23 | @click.command("list", short_help="List published resources")
24 | @click.argument("owner", required=False)
25 | @click.option("--urn-type", type=click.Choice(["prn:reg:pkg"]), default="prn:reg:pkg")
26 | @click.option("--json-output", is_flag=True)
27 | def access_list_cmd(owner, urn_type, json_output): # pylint: disable=unused-argument
28 | reg_client = RegistryClient()
29 | resources = reg_client.list_resources(owner=owner)
30 | if json_output:
31 | return click.echo(json.dumps(resources))
32 | if not resources:
33 | return click.secho("You do not have any resources.", fg="yellow")
34 | for resource in resources:
35 | click.echo()
36 | click.secho(resource.get("name"), fg="cyan")
37 | click.echo("-" * len(resource.get("name")))
38 | table_data = []
39 | table_data.append(("URN:", resource.get("urn")))
40 | table_data.append(("Owner:", resource.get("owner")))
41 | table_data.append(
42 | (
43 | "Access:",
44 | (
45 | click.style("Private", fg="red")
46 | if resource.get("private", False)
47 | else "Public"
48 | ),
49 | )
50 | )
51 | table_data.append(
52 | (
53 | "Access level(s):",
54 | ", ".join(
55 | (level.capitalize() for level in resource.get("access_levels"))
56 | ),
57 | )
58 | )
59 | click.echo(tabulate(table_data, tablefmt="plain"))
60 | return click.echo()
61 |
--------------------------------------------------------------------------------
/platformio/account/team/commands/list.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import json
16 |
17 | import click
18 | from tabulate import tabulate
19 |
20 | from platformio.account.client import AccountClient
21 |
22 |
23 | @click.command("list", short_help="List teams")
24 | @click.argument("orgname", required=False)
25 | @click.option("--json-output", is_flag=True)
26 | def team_list_cmd(orgname, json_output):
27 | client = AccountClient()
28 | data = {}
29 | if not orgname:
30 | for item in client.list_orgs():
31 | teams = client.list_teams(item.get("orgname"))
32 | data[item.get("orgname")] = teams
33 | else:
34 | teams = client.list_teams(orgname)
35 | data[orgname] = teams
36 | if json_output:
37 | return click.echo(json.dumps(data[orgname] if orgname else data))
38 | if not any(data.values()):
39 | return click.secho("You do not have any teams.", fg="yellow")
40 | for org_name, teams in data.items():
41 | for team in teams:
42 | click.echo()
43 | click.secho("%s:%s" % (org_name, team.get("name")), fg="cyan")
44 | click.echo("-" * len("%s:%s" % (org_name, team.get("name"))))
45 | table_data = []
46 | if team.get("description"):
47 | table_data.append(("Description:", team.get("description")))
48 | table_data.append(
49 | (
50 | "Members:",
51 | (
52 | ", ".join(
53 | (member.get("username") for member in team.get("members"))
54 | )
55 | if team.get("members")
56 | else "-"
57 | ),
58 | )
59 | )
60 | click.echo(tabulate(table_data, tablefmt="plain"))
61 | return click.echo()
62 |
--------------------------------------------------------------------------------
/platformio/account/commands/update.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2014-present PlatformIO
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import click
16 |
17 | from platformio.account.client import AccountClient, AccountNotAuthorized
18 | from platformio.account.validate import validate_email, validate_username
19 |
20 |
21 | @click.command("update", short_help="Update profile information")
22 | @click.option("--current-password", prompt=True, hide_input=True)
23 | @click.option("--username")
24 | @click.option("--email")
25 | @click.option("--firstname")
26 | @click.option("--lastname")
27 | def account_update_cmd(current_password, **kwargs):
28 | client = AccountClient()
29 | profile = client.get_profile()
30 | new_profile = profile.copy()
31 | if not any(kwargs.values()):
32 | for field in profile:
33 | new_profile[field] = click.prompt(
34 | field.replace("_", " ").capitalize(), default=profile[field]
35 | )
36 | if field == "email":
37 | validate_email(new_profile[field])
38 | if field == "username":
39 | validate_username(new_profile[field])
40 | else:
41 | new_profile.update({key: value for key, value in kwargs.items() if value})
42 | client.update_profile(new_profile, current_password)
43 | click.secho("Profile successfully updated!", fg="green")
44 | username_changed = new_profile["username"] != profile["username"]
45 | email_changed = new_profile["email"] != profile["email"]
46 | if not username_changed and not email_changed:
47 | return None
48 | try:
49 | client.logout()
50 | except AccountNotAuthorized:
51 | pass
52 | if email_changed:
53 | click.secho(
54 | "Please check your mail to verify your new email address and re-login. ",
55 | fg="yellow",
56 | )
57 | return None
58 | click.secho("Please re-login.", fg="yellow")
59 | return None
60 |
--------------------------------------------------------------------------------
/platformio/project/integration/tpls/eclipse/.settings/language.settings.xml.tpl:
--------------------------------------------------------------------------------
1 | % cxx_stds = [arg for arg in cxx_flags if arg.startswith("-std=")]
2 | % cxx_std = cxx_stds[-1] if cxx_stds else ""
3 | %
4 | % if cxx_path.startswith(user_home_dir):
5 | % if "windows" in systype:
6 | % cxx_path = "${USERPROFILE}" + cxx_path.replace(user_home_dir, "")
7 | % else:
8 | % cxx_path = "${HOME}" + cxx_path.replace(user_home_dir, "")
9 | % end
10 | % end
11 | %
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------