diff --git a/.btd.yml b/.btd.yml deleted file mode 100644 index e3509f7..0000000 --- a/.btd.yml +++ /dev/null @@ -1,8 +0,0 @@ -input: doc -output: _build -requirements: requirements.txt -target: gh-pages -formats: [ html ] -images: - base: btdi/sphinx:pytooling -theme: https://codeload.GitHub.com/buildthedocs/sphinx.theme/tar.gz/v1 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3c7043c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +root = true + +[*] +charset = utf-8 +# end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab +indent_size = 2 +tab_width = 2 + + +[*.py] +indent_style = tab +indent_size = 2 + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + +[*.{json,ini}] +indent_style = tab +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.rst] +indent_style = space +indent_size = 3 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3d13757 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,30 @@ +version: 2 +updates: + # Maintain Python packages + - package-ecosystem: "pip" + directory: "/" + target-branch: dev + commit-message: + prefix: "[Dependabot]" + labels: + - Dependencies + reviewers: + - Paebbels + - Umarcor + - StefanUnrein + schedule: + interval: "daily" # Checks on Monday trough Friday. + + # Maintain GitHub Action runners + - package-ecosystem: "github-actions" + directory: "/" + target-branch: dev + commit-message: + prefix: "[Dependabot]" + labels: + - Dependencies + reviewers: + - Paebbels + - Umarcor + schedule: + interval: "weekly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..4ed2d90 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,30 @@ +# New Features + +* tbd +* tbd + +# Changes + +* tbd +* tbd + +# Bug Fixes + +* tbd +* tbd + +# Documentation + +* tbd +* tbd + +# Unit Tests + +* tbd +* tbd + +---------- +# Related Issues and Pull-Requests + +* tbd +* tbd diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 0117b5b..3453027 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -4,37 +4,15 @@ on: push: workflow_dispatch: schedule: - - cron: '0 0 * * 5' +# Every Friday at 22:00 - rerun pipeline to check for dependency-based issues + - cron: '0 22 * * 5' jobs: - - Params: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@r0 - with: - name: pyEDAA.Launcher - - BuildTheDocs: - uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@r0 - needs: - - Params - with: - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} - - PublishToGitHubPages: - uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r0 - needs: - - Params - - BuildTheDocs - with: - doc: ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} - - ArtifactCleanUp: - uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@r0 - needs: - - Params - - BuildTheDocs - - PublishToGitHubPages + Pipeline: + uses: pyTooling/Actions/.github/workflows/CompletePipeline.yml@r2 with: - package: ${{ fromJson(needs.Params.outputs.params).artifacts.package }} - remaining: | - ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} + package_namespace: pyEDAA + package_name: Launcher + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} diff --git a/.gitignore b/.gitignore index 14591d7..3ad1ac3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,13 @@ __pycache__/ .coverage .cov coverage.xml +/report/coverage + +# mypy +/report/typing + +# pytest +/report/unit # setuptools /build/**/*.* @@ -21,5 +28,8 @@ coverage.xml /doc/pyEDAA.Launcher/**/*.* !/doc/pyEDAA.Launcher/index.rst -# PyCharm project +# PyCharm project files /.idea/workspace.xml + +# Git files +!.git* diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..920d523 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d56657a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..24e7e3a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pyEDAA.Launcher.iml b/.idea/pyEDAA.Launcher.iml new file mode 100644 index 0000000..366a9e5 --- /dev/null +++ b/.idea/pyEDAA.Launcher.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..b4aef4c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,82 @@ +This is a local copy of the Apache License Version 2.0. +The original can be obtained here: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + +-------------------------------------------------------------------------------- + +# Apache License + +Version 2.0, January 2004 + +## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +### 1. Definitions. + +*"License"* shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +*"Licensor"* shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +*"Legal Entity"* shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +*"You"* (or *"Your"*) shall mean an individual or Legal Entity exercising permissions granted by this License. + +*"Source"* form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +*"Object"* form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +*"Work"* shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +*"Derivative Works"* shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +*"Contribution"* shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, *"submitted"* means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as *"Not a Contribution."* + +*"Contributor"* shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +### 2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +### 3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +### 4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + - You must give any other recipients of the Work or Derivative Works a copy of this License; and + - You must cause any modified files to carry prominent notices stating that You changed the files; and + - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +### 5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +### 6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +### 7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +### 8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +### 9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + + +## Appendix: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 072fe8d..1a44561 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Documentation](https://img.shields.io/website?longCache=true&style=flat-square&label=edaa-org.github.io%2FpyEDAA.Launcher&logo=GitHub&logoColor=fff&up_color=blueviolet&up_message=Read%20now%20%E2%9E%9A&url=https%3A%2F%2Fedaa-org.github.io%2FpyEDAA.Launcher%2Findex.html)](https://edaa-org.github.io/pyEDAA.Launcher/) [![Gitter](https://img.shields.io/badge/chat-on%20gitter-4db797.svg?longCache=true&style=flat-square&logo=gitter&logoColor=e8ecef)](https://gitter.im/hdl/community) [![GitHub Workflow - Build and Test Status](https://img.shields.io/github/workflow/status/edaa-org/pyEDAA.Launcher/Pipeline/main?longCache=true&style=flat-square&label=Build%20and%20Test&logo=GitHub%20Actions&logoColor=FFFFFF)](https://GitHub.com/edaa-org/pyEDAA.Launcher/actions/workflows/Pipeline.yml) +[![Codacy - Quality](https://img.shields.io/codacy/grade/83936550d5094383bb89bb117c0abbfe?longCache=true&style=flat-square&logo=Codacy)](https://app.codacy.com/gh/edaa-org/pyEDAA.Launcher) -

- -

+**pyEDAA.Launcher** starts the correct Xilinx Vivado version based on the version number written into the ``*.xpr`` file. +If no suitable version was found, an error message is shown. + +# Main Goals + +When opening Xilinx Vivado by double-clicking an ``*.xpr`` file in the Windows Explorer, a default Vivado version is +launched by Windows. In many cases, this is the first Vivado version that was installed on a system, but not the latest +version. Anyhow, in most cases, Windows starts the wrong Vivado version, which leeds to a project upgrade question, or a +rejection, because the project file is too new. + +**pyEDAA.Launcher** addresses exactly this problem. It will start the correct Xilinx Vivado installation with correct +working directory settings, if that requested Vivado version is found on the system. + +## How does it work? + +1. Check with which Vivado version was used to save the ``*.xpr`` file. +2. Scan the Xilinx installation directory for available Vivado versions. +3. If a matching version was found, start Vivado and pass the ``*.xpr`` as a parameter. + +## Differences to opening the ``*.xpr`` from GUI? + +By default, Xilinx Vivado has its working directory in ``AppData``, but the working directory should be in the directory +where the ``*.xpr`` file is located. This is fixed by **pyEDAA.Launcher** as a side effect. Now, Vivado saves log and +journal files to the correct locations. + + +> # Installation +> * Copy the executable from the releases to the Vivado installation Path. For me its `C:\Xilinx\Vivado\`. +> * In this Path you should see the installation-folders of all Vivado Versions. E.g: 2018.3, 2019.1, ... +> * Change File-association: Right click on `*.xpr` -> open with -> choose another app -> and select the `VivadoLauncher.exe` +> * That's it. + +> Note for Xilinx: Feel free to include this in the next release to stop this version madness. Please inform us then. + +# Contributors + +* [Stefan Unrein](https://GitHub.com/stefanunrein) (Maintainer) +* [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer) +* [Unai Martinez-Corral](https://GitHub.com/umarcor) (Maintainer) +* [and more...](https://GitHub.com/edaa-org/pyEDAA.Launcher/graphs/contributors) + +# License + +This Python package (source code) licensed under [Apache License 2.0](LICENSE.md). +The accompanying documentation is licensed under [Creative Commons - Attribution 4.0 (CC-BY 4.0)](doc/Doc-License.rst). + +------------------------- +SPDX-License-Identifier: Apache-2.0 diff --git a/dist/build.cmd b/dist/build.cmd new file mode 100644 index 0000000..49c67ce --- /dev/null +++ b/dist/build.cmd @@ -0,0 +1 @@ +pyinstaller -F -n VivadoLauncher.exe --icon=vivado_logo.ico --clean --distpath=. --workpath=./temp ../pyEDAA/Launcher/__init__.py diff --git a/dist/requirements.txt b/dist/requirements.txt new file mode 100644 index 0000000..7d2dc77 --- /dev/null +++ b/dist/requirements.txt @@ -0,0 +1 @@ +pyinstaller>=4.7 diff --git a/dist/vivado_logo.ico b/dist/vivado_logo.ico new file mode 100644 index 0000000..43ec038 Binary files /dev/null and b/dist/vivado_logo.ico differ diff --git a/doc/Dependency.rst b/doc/Dependency.rst new file mode 100644 index 0000000..1e8224c --- /dev/null +++ b/doc/Dependency.rst @@ -0,0 +1,252 @@ +.. _DEP: + +Dependencies +############ + +.. |img-Launcher-lib-status| image:: https://img.shields.io/librariesio/release/pypi/pyEDAA.Launcher + :alt: Libraries.io status for latest release + :height: 22 + :target: https://libraries.io/github/edaa-org/pyEDAA.Launcher +.. |img-Launcher-vul-status| image:: https://img.shields.io/snyk/vulnerabilities/github/edaa-org/pyEDAA.Launcher + :alt: Snyk Vulnerabilities for GitHub Repo + :height: 22 + :target: https://img.shields.io/snyk/vulnerabilities/github/edaa-org/pyEDAA.Launcher + ++------------------------------------------+------------------------------------------+ +| `Libraries.io `_ | Vulnerabilities Summary | ++==========================================+==========================================+ +| |img-Launcher-lib-status| | |img-Launcher-vul-status| | ++------------------------------------------+------------------------------------------+ + +.. _DEP/package: + +pyEDAA.Launcher Package (Mandatory) +*********************************** + +.. rubric:: Manually Installing Package Requirements + +Use the :file:`requirements.txt` file to install all dependencies via ``pip3`` or install the package directly from +PyPI (see :ref:`INSTALL`). + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + pip3 install -U -r requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip install -U -r requirements.txt + + +.. rubric:: Dependency List + ++---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++=======================================================================================+=============+==========================================================================================================+================================================================================================================================================================================================+ +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | * `argcomplete `__ (`Apache License, 2.0 `__) | ++---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `pyEDAA.CLITool `__ | ≥0.4.0 | `Apache License, 2.0 `__ | * `pyTooling `__ (`Apache License, 2.0 `__) | +| | | | * `pyVHDLModel `__ (`Apache License, 2.0 `__) | +| | | | | +| | | | * `pyTooling `__ (`Apache License, 2.0 `__) | ++---------------------------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + + +.. _DEP/testing: + +Unit Testing (Optional) +*********************** + +Unit Testing / Coverage / Type Checking (Optional) +================================================== + +Additional Python packages needed for testing, code coverage collection and static type checking. These packages are +only needed for developers or on a CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Test Requirements + +Use the :file:`tests/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install +the mandatory dependencies too. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + pip install -U -r tests/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r tests\requirements.txt + +.. rubric:: Dependency List - Unit Testing + ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++=====================================================================+=============+========================================================================================+======================+ +| `pytest `__ | ≥8.3 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `pytest-cov `__ | ≥6.0 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `Coverage `__ | ≥7.6 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `mypy `__ | ≥1.13 | `MIT `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `typing-extensions `__ | ≥4.12 | `PSF-2.0 `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `lxml `__ | ≥5.3 | `BSD 3-Clause `__ | *Not yet evaluated.* | ++---------------------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ + + + +.. _DEP/documentation: + +Sphinx Documentation (Optional) +******************************* + +Additional Python packages needed for documentation generation. These packages are only needed for developers or on a +CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Documentation Requirements + +Use the :file:`doc/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install +the mandatory dependencies too. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + pip install -U -r doc/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r doc\requirements.txt + + +.. rubric:: Dependency List + ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | *None* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `Sphinx `__ | ≥8.1 | `BSD 3-Clause `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinxcontrib-mermaid `__ | ≥1.0 | `BSD `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `autoapi `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinx_design `__ | ≥0.6 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinx-copybutton `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `sphinx_autodoc_typehints `__ | ≥2.5 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `ruamel.yaml `__ | ≥0.18 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ + +.. _DEP/packaging: + +Packaging (Optional) +******************** + +Additional Python packages needed for installation package generation. These packages are only needed for developers or +on a CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Packaging Requirements + +Use the :file:`build/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively +install the mandatory dependencies too. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + pip install -U -r build/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r build\requirements.txt + + +.. rubric:: Dependency List + ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ +| `pyTooling `__ | ≥8.0 | `Apache License, 2.0 `__ | *None* | ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `wheel `__ | ≥0.45 | `MIT `__ | *Not yet evaluated.* | ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ + + +.. _DEP/publishing: + +Publishing (CI-Server only) +*************************** + +Additional Python packages needed for publishing the generated installation package to e.g, PyPI or any equivalent +services. These packages are only needed for maintainers or on a CI server, thus sub-dependencies are not evaluated +further. + + +.. rubric:: Manually Installing Publishing Requirements + +Use the :file:`dist/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively +install the mandatory dependencies too. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + pip install -U -r dist/requirements.txt + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + pip3 install -U -r dist\requirements.txt + + +.. rubric:: Dependency List + ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++==========================================================+==============+===========================================================================================+======================+ +| `wheel `__ | ≥0.45 | `MIT `__ | *Not yet evaluated.* | ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ +| `Twine `__ | ≥5.1 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/Doc-License.rst b/doc/Doc-License.rst new file mode 100644 index 0000000..1258fbc --- /dev/null +++ b/doc/Doc-License.rst @@ -0,0 +1,353 @@ +.. _DOCLICENSE: + +.. Note:: This is a local copy of the `Creative Commons - Attribution 4.0 International (CC BY 4.0) `__. + +.. Attention:: This **CC BY 4.0** license applies only to the **documentation** of this project. + + +Creative Commons Attribution 4.0 International +############################################## + +Creative Commons Corporation (“Creative Commons”) is not a law firm and does not +provide legal services or legal advice. Distribution of Creative Commons public +licenses does not create a lawyer-client or other relationship. Creative Commons +makes its licenses and related information available on an “as-is” basis. +Creative Commons gives no warranties regarding its licenses, any material +licensed under their terms and conditions, or any related information. Creative +Commons disclaims all liability for damages resulting from their use to the +fullest extent possible. + +.. topic:: Using Creative Commons Public Licenses + + Creative Commons public licenses provide a standard set of terms and conditions + that creators and other rights holders may use to share original works of + authorship and other material subject to copyright and certain other rights + specified in the public license below. The following considerations are for + informational purposes only, are not exhaustive, and do not form part of our + licenses. + + * **Considerations for licensors:** Our public licenses are intended for use + by those authorized to give the public permission to use material in ways + otherwise restricted by copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms and conditions + of the license they choose before applying it. Licensors should also secure + all rights necessary before applying our licenses so that the public can reuse + the material as expected. Licensors should clearly mark any material not + subject to the license. This includes other CC-licensed material, or material + used under an exception or limitation to copyright. + `More considerations for licensors `__. + + * **Considerations for the public:** By using one of our public licenses, a + licensor grants the public permission to use the licensed material under + specified terms and conditions. If the licensor’s permission is not necessary + for any reason–for example, because of any applicable exception or limitation + to copyright–then that use is not regulated by the license. Our licenses grant + only permissions under copyright and certain other rights that a licensor has + authority to grant. Use of the licensed material may still be restricted for + other reasons, including because others have copyright or other rights in the + material. A licensor may make special requests, such as asking that all + changes be marked or described. Although not required by our licenses, you are + encouraged to respect those requests where reasonable. + `More considerations for the public `__. + +:xlarge:`Creative Commons Attribution 4.0 International Public License` + +By exercising the Licensed Rights (defined below), You accept and agree to be +bound by the terms and conditions of this Creative Commons Attribution 4.0 +International Public License ("Public License"). To the extent this Public +License may be interpreted as a contract, You are granted the Licensed Rights +in consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the Licensor +receives from making the Licensed Material available under these terms and +conditions. + +Section 1 – Definitions. +======================== + +a. **Adapted Material** means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material and in + which the Licensed Material is translated, altered, arranged, transformed, or + otherwise modified in a manner requiring permission under the Copyright and + Similar Rights held by the Licensor. For purposes of this Public License, + where the Licensed Material is a musical work, performance, or sound + recording, Adapted Material is always produced where the Licensed Material + is synched in timed relation with a moving image. + +b. **Adapter's License** means the license You apply to Your Copyright and + Similar Rights in Your contributions to Adapted Material in accordance with + the terms and conditions of this Public License. + +c. **Copyright and Similar Rights** means copyright and/or similar rights + closely related to copyright including, without limitation, performance, + broadcast, sound recording, and Sui Generis Database Rights, without regard + to how the rights are labeled or categorized. For purposes of this Public + License, the rights specified in Section 2(b)(1)-(2) are not Copyright and + Similar Rights. + +d. **Effective Technological Measures** means those measures that, in the + absence of proper authority, may not be circumvented under laws fulfilling + obligations under Article 11 of the WIPO Copyright Treaty adopted on + December 20, 1996, and/or similar international agreements. + +e. **Exceptions and Limitations** means fair use, fair dealing, and/or any + other exception or limitation to Copyright and Similar Rights that applies to + Your use of the Licensed Material. + +f. **Licensed Material** means the artistic or literary work, database, or + other material to which the Licensor applied this Public License. + +g. **Licensed Rights** means the rights granted to You subject to the terms + and conditions of this Public License, which are limited to all Copyright and + Similar Rights that apply to Your use of the Licensed Material and that the + Licensor has authority to license. + +h. **Licensor** means the individual(s) or entity(ies) granting rights under + this Public License. + +i. **Share** means to provide material to the public by any means or process + that requires permission under the Licensed Rights, such as reproduction, + public display, public performance, distribution, dissemination, + communication, or importation, and to make material available to the public + including in ways that members of the public may access the material from a + place and at a time individually chosen by them. + +j. **Sui Generis Database Rights** means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of the + Council of 11 March 1996 on the legal protection of databases, as amended + and/or succeeded, as well as other essentially equivalent rights anywhere + in the world. + +k. **You** means the individual or entity exercising the Licensed Rights + under this Public License. **Your** has a corresponding meaning. + +Section 2 – Scope. +================== + +a. **License grant.** + + 1. Subject to the terms and conditions of this Public License, the Licensor + hereby grants You a worldwide, royalty-free, non-sublicensable, + non-exclusive, irrevocable license to exercise the Licensed Rights in the + Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. :underline:`Exceptions and Limitations.` For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public License does not + apply, and You do not need to comply with its terms and conditions. + + 3. :underline:`Term.` The term of this Public License is specified in Section 6(a). + + 4. :underline:`Media and formats`; :underline:`technical modifications allowed.` The Licensor + authorizes You to exercise the Licensed Rights in all media and formats + whether now known or hereafter created, and to make technical + modifications necessary to do so. The Licensor waives and/or agrees not to + assert any right or authority to forbid You from making technical + modifications necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective Technological + Measures. For purposes of this Public License, simply making modifications + authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. :underline:`Downstream recipients.` + + A. :underline:`Offer from the Licensor – Licensed Material.` Every recipient of + the Licensed Material automatically receives an offer from the + Licensor to exercise the Licensed Rights under the terms and + conditions of this Public License. + + B. :underline:`No downstream restrictions.` You may not offer or impose any + additional or different terms or conditions on, or apply any Effective + Technological Measures to, the Licensed Material if doing so restricts + exercise of the Licensed Rights by any recipient of the Licensed + Material. + + 6. :underline:`No endorsement.` Nothing in this Public License constitutes or may + be construed as permission to assert or imply that You are, or that Your + use of the Licensed Material is, connected with, or sponsored, endorsed, + or granted official status by, the Licensor or others designated to + receive attribution as provided in Section 3(a)(1)(A)(i). + +b. **Other rights.** + + 1. Moral rights, such as the right of integrity, are not licensed under this + Public License, nor are publicity, privacy, and/or other similar + personality rights; however, to the extent possible, the Licensor waives + and/or agrees not to assert any such rights held by the Licensor to the + limited extent necessary to allow You to exercise the Licensed Rights, but + not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties + from You for the exercise of the Licensed Rights, whether directly or + through a collecting society under any voluntary or waivable statutory or + compulsory licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + +Section 3 – License Conditions. +=============================== + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + +a. **Attribution.** + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the + Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any + others designated to receive attribution, in any reasonable manner + requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably + practicable; + + B. indicate if You modified the Licensed Material and retain an + indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, + and include the text of, or the URI or hyperlink to, this Public + License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner + based on the medium, means, and context in which You Share the Licensed + Material. For example, it may be reasonable to satisfy the conditions by + providing a URI or hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the information + required by Section 3(a)(1)(A) to the extent reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's License You apply + must not prevent recipients of the Adapted Material from complying with + this Public License. + +Section 4 – Sui Generis Database Rights. +======================================== + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your +use of the Licensed Material: + +a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, + reuse, reproduce, and Share all or a substantial portion of the contents of + the database; + +b. if You include all or a substantial portion of the database contents in a + database in which You have Sui Generis Database Rights, then the database + in which You have Sui Generis Database Rights (but not its individual + contents) is Adapted Material; and + +c. You must comply with the conditions in Section 3(a) if You Share all or a + substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace +Your obligations under this Public License where the Licensed Rights include +other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. +================================================================= + +a. **Unless otherwise separately undertaken by the Licensor, to the extent + possible, the Licensor offers the Licensed Material as-is and as-available, + and makes no representations or warranties of any kind concerning the + Licensed Material, whether express, implied, statutory, or other. This + includes, without limitation, warranties of title, merchantability, + fitness for a particular purpose, non-infringement, absence of latent or + other defects, accuracy, or the presence or absence of errors, whether or + not known or discoverable. Where disclaimers of warranties are not allowed + in full or in part, this disclaimer may not apply to You.** + +b. **To the extent possible, in no event will the Licensor be liable to You + on any legal theory (including, without limitation, negligence) or + otherwise for any direct, special, indirect, incidental, consequential, + punitive, exemplary, or other losses, costs, expenses, or damages arising + out of this Public License or use of the Licensed Material, even if the + Licensor has been advised of the possibility of such losses, costs, expenses, + or damages. Where a limitation of liability is not allowed in full or in + part, this limitation may not apply to You.** + +c. The disclaimer of warranties and limitation of liability provided above + shall be interpreted in a manner that, to the extent possible, most + closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. +================================= + +a. This Public License applies for the term of the Copyright and Similar Rights + licensed here. However, if You fail to comply with this Public License, then + Your rights under this Public License terminate automatically. + +b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured + within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any right the + Licensor may have to seek remedies for Your violations of this Public License. + +c. For the avoidance of doubt, the Licensor may also offer the Licensed Material + under separate terms or conditions or stop distributing the Licensed Material + at any time; however, doing so will not terminate this Public License. + +d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. +======================================= + +a. The Licensor shall not be bound by any additional or different terms or + conditions communicated by You unless expressly agreed. + +b. Any arrangements, understandings, or agreements regarding the Licensed + Material not stated herein are separate from and independent of the terms + and conditions of this Public License. + +Section 8 – Interpretation. +=========================== + +a. For the avoidance of doubt, this Public License does not, and shall not be + interpreted to, reduce, limit, restrict, or impose conditions on any use of + the Licensed Material that could lawfully be made without permission under + this Public License. + +b. To the extent possible, if any provision of this Public License is deemed + unenforceable, it shall be automatically reformed to the minimum extent + necessary to make it enforceable. If the provision cannot be reformed, it + shall be severed from this Public License without affecting the + enforceability of the remaining terms and conditions. + +c. No term or condition of this Public License will be waived and no failure to + comply consented to unless expressly agreed to by the Licensor. + +d. Nothing in this Public License constitutes or may be interpreted as a + limitation upon, or waiver of, any privileges and immunities that apply to + the Licensor or You, including from the legal processes of any jurisdiction + or authority. + +------------------ + +Creative Commons is not a party to its public licenses. Notwithstanding, +Creative Commons may elect to apply one of its public licenses to material it +publishes and in those instances will be considered the “Licensor.” Except for +the limited purpose of indicating that material is shared under a Creative +Commons public license or as otherwise permitted by the Creative Commons +policies published at `creativecommons.org/policies `__, +Creative Commons does not authorize the use of the trademark “Creative Commons” +or any other trademark or logo of Creative Commons without its prior written +consent including, without limitation, in connection with any unauthorized +modifications to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For the +avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at `creativecommons.org `__ diff --git a/doc/DocCoverage.rst b/doc/DocCoverage.rst new file mode 100644 index 0000000..c1e7526 --- /dev/null +++ b/doc/DocCoverage.rst @@ -0,0 +1,7 @@ +Documentation Coverage +###################### + +Documentation coverage generated by `docstr-coverage `__. + +.. report:doc-coverage:: + :packageid: src diff --git a/doc/Glossary.rst b/doc/Glossary.rst new file mode 100644 index 0000000..189fabb --- /dev/null +++ b/doc/Glossary.rst @@ -0,0 +1,13 @@ +Glossary +######## + +.. glossary:: + + Vivado + Is a toolchain for FPGA bitstream generation provided by Xilinx (now AMD). + + XML + Extensible Markup Language + + XPR file + Xilinx (Vivado) project file based on XML. diff --git a/doc/Installation.rst b/doc/Installation.rst new file mode 100644 index 0000000..c414472 --- /dev/null +++ b/doc/Installation.rst @@ -0,0 +1,486 @@ +.. |PackageName| replace:: pyEDAA.Launcher + +.. _INSTALL: + +Installation/Updates +#################### + +See the following instructions on how to install or update the package from common sources like PyPI. Developers can +also install the packages with development dependencies. In case of local development, see the additional sections on +how to run unit tests, type checks or how to build the documentation to create all the build artifacts. + +See the list of :ref:`necessary dependencies `. + + +.. _INSTALL/pip: + +Using PIP to Install from PyPI +****************************** + +The following instruction are using PIP (Package Installer for Python) as a package manager and PyPI (Python Package +Index) as a source of Python packages. + +PIP might download further packages as listed in :ref:`package dependencies `. + + +.. _INSTALL/pip/install: + +Installing a Wheel Package from PyPI using PIP +============================================== + +Developers can install the |PackageName| package itself or the package with further dependencies for documentation +generation (``doc``), running unit tests (``test``) or just all (``all``) dependencies. + +See :ref:`DEP` for more details. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Minimal installation + :sync: Minimal + + .. code-block:: bash + + # Basic pyEDAA.Launcher package + pip3 install pyEDAA.Launcher + + # Alternatively + python3 -m pip install pyEDAA.Launcher + + .. tab-item:: With Documentation Dependencies + :sync: Doc + + .. code-block:: bash + + # Install with dependencies to generate documentation + pip3 install pyEDAA.Launcher[doc] + + # Alternatively + python3 -m pip install pyEDAA.Launcher[doc] + + .. tab-item:: With Unit Testing Dependencies + :sync: Unit + + .. code-block:: bash + + # Install with dependencies to run unit tests + pip3 install pyEDAA.Launcher[test] + + # Alternatively + python3 -m pip install pyEDAA.Launcher[test] + + .. tab-item:: All Developer Dependencies + :sync: All + + .. code-block:: bash + + # Install with all developer dependencies + pip3 install pyEDAA.Launcher[all] + + # Alternatively + python3 -m pip install pyEDAA.Launcher[all] + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Minimal installation + :sync: Minimal + + .. code-block:: powershell + + # Basic pyEDAA.Launcher package + pip install pyEDAA.Launcher + + # Alternatively + py -m pip install pyEDAA.Launcher + + .. tab-item:: With Documentation Dependencies + :sync: Doc + + .. code-block:: powershell + + # Install with dependencies to generate documentation + pip install pyEDAA.Launcher[doc] + + # Alternatively + py -m pip install pyEDAA.Launcher[doc] + + .. tab-item:: With Unit Testing Dependencies + :sync: Unit + + .. code-block:: powershell + + # Install with dependencies to run unit tests + pip install pyEDAA.Launcher[test] + + # Alternatively + py -m pip install pyEDAA.Launcher[test] + + .. tab-item:: All Developer Dependencies + :sync: All + + .. code-block:: powershell + + # Install with all developer dependencies + pip install pyEDAA.Launcher[all] + + # Alternatively + py -m pip install pyEDAA.Launcher[all] + + +.. _INSTALL/pip/requirements: + +Referencing the package in ``requirements.txt`` +=============================================== + +When |PackageName| is used by another Python package, it's recommended to list the dependency to the |PackageName| +package in a ``requirements.txt`` file. + +.. admonition:: ``requirements.txt`` + + .. code-block:: text + + pyEDAA.Launcher ~= 0.3 + + +.. _INSTALL/pip/update: + +Updating from PyPI using PIP +============================ + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + # Update pyEDAA.Launcher + pip3 install -U pyEDAA.Launcher + + # Alternatively + python3 -m pip install -U pyEDAA.Launcher + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + # Update pyEDAA.Launcher + pip install -U pyEDAA.Launcher + + # Alternatively + py -m pip install -U pyEDAA.Launcher + + +.. _INSTALL/pip/uninstall: + +Uninstallation using PIP +======================== + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + # Uninstall pyEDAA.Launcher + pip3 uninstall pyEDAA.Launcher + + # Alternatively + python3 -m pip uninstall pyEDAA.Launcher + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + # Uninstall pyEDAA.Launcher + pip uninstall pyEDAA.Launcher + + # Alternatively + py -m pip uninstall pyEDAA.Launcher + + +.. _INSTALL/testing: + +Running unit tests +****************** + +This package is provided with unit tests for `pytest `__. The provided testcases can be +executed locally for testing or development purposes. In addition, code coverage including branch coverage can be +collected using `Coverage.py `__. All steps provide appropriate artifacts as XML or +HTML reports. The artifact output directories are specified in ``pyproject.toml``. + +Ensure :ref:`unit testing requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Unit Testing + :sync: UnitTesting + + .. code-block:: bash + + cd + + # Running unit tests using pytest + pytest -raP --color=yes tests/unit + + .. tab-item:: Unit Testing with Ant/JUnit XML Reports + :sync: UnitTestingXML + + .. code-block:: bash + + cd + + # Running unit tests using pytest + pytest -raP --color=yes --junitxml=report/unit/unittest.xml --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit + + .. tab-item:: Unit Testing with Code Coverage + :sync: Coverage + + .. code-block:: bash + + cd + + # Running unit tests with code coverage using Coverage.py + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests/unit + + # Write coverage report to console" + coverage report + + # Convert coverage report to HTML + coverage html + + # Convert coverage report to XML (Cobertura) + coverage xml + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Unit Testing + :sync: UnitTesting + + .. code-block:: powershell + + cd + + # Running unit tests using pytest + pytest -raP --color=yes tests\unit + + .. tab-item:: Unit Testing with Ant/JUnit XML Reports + :sync: UnitTestingXML + + .. code-block:: powershell + + cd + + # Running unit tests using pytest + pytest -raP --color=yes --junitxml=report\unit\unittest.xml --template=html1\index.html --report=report\unit\html\index.html --split-report tests\unit + + .. tab-item:: Unit Testing with Code Coverage + :sync: Coverage + + .. code-block:: powershell + + cd + + # Running unit tests with code coverage using Coverage.py + coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --tb=line --color=yes tests\unit + + # Write coverage report to console" + coverage report + + # Convert coverage report to HTML + coverage html + + # Convert coverage report to XML (Cobertura) + coverage xml + + +.. _INSTALL/typechecking: + +Running type checks +******************* + +This package is provided with type checks. These can be executed locally for testing or development purposes using +`mypy `__. The artifact output directory is specified in ``pyproject.toml``. + +Ensure :ref:`unit testing requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + cd + + # Running type checking using mypy + export MYPY_FORCE_COLOR=1 + mypy -p pyEDAA.Launcher + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + cd + + # Running type checking using mypy + $env:MYPY_FORCE_COLOR = 1 + mypy -p pyEDAA.Launcher + + +.. _INSTALL/documentation: + +Building documentation +********************** + +The documentation can be build locally using `Sphinx `__. It can generate HTML and LaTeX +outputs. In an additional step, the LaTeX output can be translated to a PDF file using a LaTeX environment like +`MiKTeX `__. + +Ensure :ref:`documentation requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. tab-set:: + + .. tab-item:: Generating HTML + :sync: HTML + + .. code-block:: bash + + cd + + # Adding package root to PYTHONPATH + export PYTHONPATH=$(pwd) + cd doc + + # Building documentation using Sphinx + sphinx-build -v -n -b html -d _build/doctrees -j $(nproc) -w _build/html.log . _build/html + + .. tab-item:: Generating LaTeX + :sync: LaTeX + + .. code-block:: bash + + cd + + # Adding package root to PYTHONPATH + export PYTHONPATH=$(pwd) + cd doc + + # Building documentation using Sphinx + sphinx-build -v -n -b latex -d _build/doctrees -j $(nproc) -w _build/latex.log . _build/latex + + .. tab-item:: Generating PDF (from LaTeX) + :sync: PDF + + .. todo:: Describe LaTeX to PDF conversion on Linux using Miktex. + + .. hint:: A `Miktex installation `__ is required. + + .. tab-item:: Windows + :sync: Windows + + .. tab-set:: + + .. tab-item:: Generating HTML + :sync: HTML + + .. code-block:: powershell + + cd + + # Building documentation using Sphinx + .\doc\make.bat html --verbose + + .. tab-item:: Generating LaTeX + :sync: LaTeX + + .. code-block:: powershell + + cd + + # Building documentation using Sphinx + .\doc\make.bat latex --verbose + + .. tab-item:: Generating PDF (from LaTeX) + :sync: PDF + + .. todo:: Describe LaTeX to PDF conversion on Windows using Miktex. + + .. hint:: A `Miktex installation `__ is required. + + +.. _INSTALL/building: + +Local Packaging and Installation via PIP +**************************************** + +For development and bug fixing it might be handy to create a local wheel package and also install it locally on the +development machine. The following instructions will create a local wheel package (``*.whl``) and then use PIP to +install it. As a user might have a |PackageName| installation from PyPI, it's recommended to uninstall any previous +|PackageName| packages. (This step is also needed if installing an updated local wheel file with same version number. +PIP will not detect a new version and thus not overwrite/reinstall the updated package contents.) + +Ensure :ref:`packaging requirements ` are installed. + +.. tab-set:: + + .. tab-item:: Linux/macOS + :sync: Linux + + .. code-block:: bash + + cd + + # Package the code in a wheel (*.whl) + python3 -m build --wheel + + # Uninstall the old package + python3 -m pip uninstall -y pyEDAA.Launcher + + # Install from wheel + python3 -m pip install ./dist/pyEDAA.Launcher-0.3.0-py3-none-any.whl + + .. tab-item:: Windows + :sync: Windows + + .. code-block:: powershell + + cd + + # Package the code in a wheel (*.whl) + py -m build --wheel + + # Uninstall the old package + py -m pip uninstall -y pyEDAA.Launcher + + # Install from wheel + py -m pip install .\dist\pyEDAA.Launcher-0.3.0-py3-none-any.whl + +.. note:: + + The legacy ways of building a package using ``setup.py bdist_wheel`` and installation using ``setup.py install`` is + not recommended anymore. diff --git a/doc/License.rst b/doc/License.rst new file mode 100644 index 0000000..fba66a2 --- /dev/null +++ b/doc/License.rst @@ -0,0 +1,140 @@ +.. _SRCLICENSE: + +.. Note:: This is a local copy of the `Apache License Version 2.0 `__. + +.. Attention:: This **Apache License, 2.0** applies to all **source and configuration files of project**, **except documentation**. + +Apache License 2.0 +################## + +Version 2.0, January 2004 + +:xlarge:`TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION` + + +1. Definitions. +=============== +**"License"** shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +**"Licensor"** shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +**"Legal Entity"** shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that +entity. For the purposes of this definition, **"control"** means (i) the power, direct or indirect, to cause the direction or management of such entity, whether +by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +**"You"** (or **"Your"**) shall mean an individual or Legal Entity exercising permissions granted by this License. + +**"Source"** form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and +configuration files. + +**"Object"** form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object +code, generated documentation, and conversions to other media types. + +**"Work"** shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is +included in or attached to the work (an example is provided in the Appendix below). + +**"Derivative Works"** shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +**"Contribution"** shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative +Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to +submit on behalf of the copyright owner. For the purposes of this definition, **"submitted"** means any form of electronic, verbal, or written communication +sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is +conspicuously marked or otherwise designated in writing by the copyright owner as **"Not a Contribution."** + +**"Contributor"** shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. +============================== +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. +=========================== +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such +license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of +their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim +or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then +any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. +================== +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* You must give any other recipients of the Work or Derivative Works a copy of this License; and +* You must cause any modified files to carry prominent notices stating that You changed the files; and +* You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source + form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +* If the Work includes a **"NOTICE"** text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the + attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the + following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE + file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, + alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise +complies with the conditions stated in this License. + +5. Submission of Contributions. +=============================== +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any +separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. +============== +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable +and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. +========================== +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, +MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and +assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. +=========================== +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or +consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages +for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been +advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. +============================================== +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other +liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole +responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +---------------------------------------------------------------------------------------------------------------------------------------------------------------- + +:xlarge:`Appendix: How to apply the Apache License to your work` + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying +information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or +class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +.. code-block:: none + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/doc/Makefile b/doc/Makefile index 4dc7e78..0ff8b2e 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,3 +1,6 @@ +CP=cp + +# Sphinx options. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = @@ -7,5 +10,19 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -T -D language=en $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -%: - $(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) $(BUILDDIR)/$@ +all: html latex + +#--- + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + +#--- + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + +#--- + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex diff --git a/doc/TODO.rst b/doc/TODO.rst new file mode 100644 index 0000000..3144da0 --- /dev/null +++ b/doc/TODO.rst @@ -0,0 +1,4 @@ +TODOs +##### + +.. todolist:: diff --git a/doc/Usage.rst b/doc/Usage.rst new file mode 100644 index 0000000..798b14f --- /dev/null +++ b/doc/Usage.rst @@ -0,0 +1,4 @@ +Usage +##### + +.. todo:: Needs to be documented. diff --git a/doc/_static/css/override.css b/doc/_static/css/override.css new file mode 100644 index 0000000..4dd6beb --- /dev/null +++ b/doc/_static/css/override.css @@ -0,0 +1,115 @@ +/* theme overrides */ +.rst-content h1, +.rst-content h2 { + margin-top: 24px; + margin-bottom: 6px; + text-decoration: underline; +} + +.rst-content h3, +.rst-content h4, +.rst-content h5, +.rst-content h6 { + margin-top: 12px; + margin-bottom: 6px; +} + +.rst-content p { + margin-bottom: 6px +} + +.rst-content .topic-title { + font-size: larger; + font-weight: 700; + margin-top: 18px; + margin-bottom: 6px; +} + +.rst-content p.rubric { + text-decoration: underline; + font-weight: 700; + margin-top: 18px; + margin-bottom: 16px; +} + +/* general overrides */ +html { + font-size: 15px; +} + +footer { + font-size: 95%; + text-align: center +} + +footer p { + margin-bottom: 0px /* 12px */; + font-size: 95% +} + +section > p, +.section p, +.simple li { + text-align: justify +} + +/* wyrm overrides */ +.wy-menu-vertical header, +.wy-menu-vertical p.caption { + color: #9b9b9b /* #55a5d9 */; + padding: 0 0.809em /* 0 1.618em */; + margin: 6px 0 0 0 /* 12px 0 0 */; + border-top: 1px solid #9b9b9b; +} + +.wy-side-nav-search { + margin-bottom: 0 /* .809em */; + background-color: #333333 /* #2980b9 */; + /* BTD: */ + /*color: #fcfcfc*/ +} + +.wy-side-nav-search input[type=text] { + border-radius: 0px /* 50px */; +} + +.wy-side-nav-search .wy-dropdown > a, .wy-side-nav-search > a { + /* BTD: */ + /*color: #fcfcfc;*/ + margin-bottom: 0.404em /* .809em */; +} + +.wy-side-nav-search > div.version { + margin: 0 0 6px 0; + /* BTD: */ + /*margin-top: -.4045em;*/ +} + +.wy-nav .wy-menu-vertical a:hover { + background-color: #333333 /* #2980b9 */; +} + +.wy-nav-content { + max-width: 1600px /* 800px */ ; +} + +.wy-nav-top { + background: #333333 /* #2980b9 */; +} + +/* Sphinx Design */ +.sd-tab-set { + margin: 0 +} + +.sd-tab-set > label { + padding-top: .5em; + padding-right: 1em; + padding-bottom: .5em; + padding-left: 1em +} + +.sd-container-fluid { + padding-left: 0; + padding-right: 0; +} diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst new file mode 100644 index 0000000..4dded81 --- /dev/null +++ b/doc/_templates/autoapi/module.rst @@ -0,0 +1,160 @@ +.. # Template modified by Patrick Lehmann + * removed automodule on top, because private members are activated for autodoc (no doubled documentation). + * Made sections like 'submodules' bold text, but no headlines to reduce number of ToC levels. + +{{ '=' * node.name|length }} +{{ node.name }} +{{ '=' * node.name|length }} + +.. automodule:: {{ node.name }} + +{##} +{%- block modules -%} +{%- if subnodes %} + +**Submodules** + +.. toctree:: + :maxdepth: 1 +{% for item in subnodes %} + {{ item.name }} +{%- endfor %} +{##} +{%- endif -%} +{%- endblock -%} +{##} +.. currentmodule:: {{ node.name }} +{##} + +{%- if node.variables %} + +**Variables** + +{% for item, obj in node.variables.items() -%} +- :py:data:`{{ item }}` + {#{ obj|summary }#} +{% endfor -%} +{%- endif -%} + +{%- if node.functions %} + +**Functions** + +{% for item, obj in node.functions.items() -%} +- :py:func:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} +{%- endif -%} + +{%- if node.exceptions %} + +**Exceptions** + +{% for item, obj in node.exceptions.items() -%} +- :py:exc:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} +{%- endif -%} + +{%- if node.classes %} + +**Classes** + +{% for item, obj in node.classes.items() -%} +- :py:class:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} +{%- endif -%} + +{%- block variables -%} +{%- if node.variables %} + +--------------------- + +**Variables** + +{#% for item, obj in node.variables.items() -%} +- :py:data:`{{ item }}` +{% endfor -%#} + +{% for item, obj in node.variables.items() %} +.. autodata:: {{ item }} + :annotation: + + .. code-block:: text + + {{ obj|pprint|indent(6) }} +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block functions -%} +{%- if node.functions %} + +--------------------- + +**Functions** + +{% for item in node.functions %} +.. autofunction:: {{ item }} +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block exceptions -%} +{%- if node.exceptions %} + +--------------------- + +**Exceptions** + +{#% for item, obj in node.exceptions.items() -%} +- :py:exc:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%#} + +{% for item in node.exceptions %} +.. autoexception:: {{ item }} + + .. rubric:: Inheritance + .. inheritance-diagram:: {{ item }} + :parts: 1 +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block classes -%} +{%- if node.classes %} + +--------------------- + +**Classes** + +{#% for item, obj in node.classes.items() -%} +- :py:class:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%#} + +{% for item in node.classes %} +.. autoclass:: {{ item }} + :members: + :private-members: + :special-members: + :inherited-members: + :exclude-members: __weakref__ + + .. rubric:: Inheritance + .. inheritance-diagram:: {{ item }} + :parts: 1 +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} diff --git a/doc/_templates/autoapi/package.rst b/doc/_templates/autoapi/package.rst new file mode 100644 index 0000000..9cc9fbd --- /dev/null +++ b/doc/_templates/autoapi/package.rst @@ -0,0 +1,14 @@ +.. # Template created by Patrick Lehmann + +Python Class Reference +###################### + +Reference of all packages and modules: + +.. automodule:: {{ node.name }} + +.. toctree:: + :maxdepth: 1 +{% for item in subnodes %} + {{ item.name }} +{%- endfor %} diff --git a/doc/conf.py b/doc/conf.py index 9b71b88..60e610a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,62 +1,76 @@ # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. - from sys import path as sys_path from os.path import abspath from pathlib import Path -from json import loads +from pyTooling.Packaging import extractVersionInformation + +# ============================================================================== +# Project configuration +# ============================================================================== +githubNamespace = "edaa-org" +project = "pyEDAA.Launcher" +directoryName = project.replace('.', '/') +# ============================================================================== +# Project paths +# ============================================================================== ROOT = Path(__file__).resolve().parent -sys_path.insert(0, abspath('.')) -sys_path.insert(0, abspath('..')) +sys_path.insert(0, abspath(".")) +sys_path.insert(0, abspath("..")) +sys_path.insert(0, abspath(f"../{directoryName}")) # ============================================================================== -# Project information +# Project information and versioning # ============================================================================== -project = "pyEDAA.Launcher" -copyright = "2021-2021 Patrick Lehmann - Boetzingen, Germany" -author = "Patrick Lehmann" +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +packageInformationFile = Path(f"../{directoryName}/__init__.py") +versionInformation = extractVersionInformation(packageInformationFile) -version = "latest" # The short X.Y version. -release = "latest" # The full version, including alpha/beta/rc tags. +author = versionInformation.Author +copyright = versionInformation.Copyright +version = ".".join(versionInformation.Version.split(".")[:2]) # e.g. 2.3 The short X.Y version. +release = versionInformation.Version # ============================================================================== # Miscellaneous settings # ============================================================================== # The master toctree document. -master_doc = 'index' +master_doc = "index" # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [ "_build", - "_themes", + "_theme", "Thumbs.db", ".DS_Store" ] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'stata-dark' +pygments_style = "manni" # ============================================================================== # Restructured Text settings # ============================================================================== -prologPath = "prolog.inc" +prologPath = Path("prolog.inc") try: - with open(prologPath, "r") as prologFile: - rst_prolog = prologFile.read() + with prologPath.open("r", encoding="utf-8") as fileHandle: + rst_prolog = fileHandle.read() except Exception as ex: - print("[ERROR:] While reading '{0!s}'.".format(prologPath)) + print(f"[ERROR:] While reading '{prologPath}'.") print(ex) rst_prolog = "" @@ -64,39 +78,38 @@ # ============================================================================== # Options for HTML output # ============================================================================== - -html_context = {} -ctx = ROOT / 'context.json' -if ctx.is_file(): - html_context.update(loads(ctx.open('r').read())) - -if (ROOT / "_theme").is_dir(): - html_theme_path = ["."] - html_theme = "_theme" - html_theme_options = { - 'logo_only': True, - 'home_breadcrumbs': False, - 'vcs_pageview_mode': 'blob', - } -else: - html_theme = "alabaster" +html_theme = "sphinx_rtd_theme" +html_theme_options = { + "logo_only": True, + "vcs_pageview_mode": 'blob', + "navigation_depth": 5, +} +html_css_files = [ + 'css/override.css', +] # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] html_logo = str(Path(html_static_path[0]) / "logo.svg") html_favicon = str(Path(html_static_path[0]) / "favicon.svg") # Output file base name for HTML help builder. -htmlhelp_basename = 'pyEDAALauncherDoc' +htmlhelp_basename = f"{project}Doc" # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. html_last_updated_fmt = "%d.%m.%Y" +# ============================================================================== +# Python settings +# ============================================================================== +modindex_common_prefix = [ + f"{project}." +] # ============================================================================== # Options for LaTeX / PDF output @@ -105,13 +118,13 @@ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). - 'papersize': 'a4paper', + "papersize": "a4paper", # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. - 'preamble': dedent(r""" + "preamble": dedent(r""" % ================================================================================ % User defined additional preamble code % ================================================================================ @@ -137,10 +150,10 @@ # author, documentclass [howto, manual, or own class]). latex_documents = [ ( master_doc, - 'pyEDAA.Launcher.tex', - 'The pyEDAA.Launcher Documentation', - 'Patrick Lehmann', - 'manual' + f"{project}.tex", + f"The {project} Documentation", + f"Patrick Lehmann", + f"manual" ), ] @@ -149,8 +162,25 @@ # Extensions # ============================================================================== extensions = [ - 'sphinx.ext.extlinks', - 'sphinx.ext.intersphinx', +# Standard Sphinx extensions + "sphinx.ext.autodoc", + "sphinx.ext.extlinks", + "sphinx.ext.intersphinx", + "sphinx.ext.inheritance_diagram", + "sphinx.ext.todo", + "sphinx.ext.graphviz", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", +# SphinxContrib extensions + "sphinxcontrib.mermaid", +# Other extensions + "sphinx_design", + "sphinx_copybutton", + "sphinx_autodoc_typehints", + "autoapi.sphinx", + "sphinx_reports", +# User defined extensions ] @@ -158,15 +188,123 @@ # Sphinx.Ext.InterSphinx # ============================================================================== intersphinx_mapping = { - 'python': ('https://docs.python.org/3', None), + "python": ("https://docs.python.org/3", None), + "pyTool": ("https://pyTooling.github.io/pyTooling/", None), } +# ============================================================================== +# Sphinx.Ext.AutoDoc +# ============================================================================== +# see: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration +#autodoc_default_options = { +# "private-members": True, +# "special-members": True, +# "inherited-members": True, +# "exclude-members": "__weakref__" +#} +#autodoc_class_signature = "separated" +autodoc_member_order = "bysource" # alphabetical, groupwise, bysource +autodoc_typehints = "both" +#autoclass_content = "both" + + # ============================================================================== # Sphinx.Ext.ExtLinks # ============================================================================== extlinks = { - 'ghissue': ('https://GitHub.com/edaa-org/pyEDAA.Launcher/issues/%s', 'issue #'), - 'ghpull': ('https://GitHub.com/edaa-org/pyEDAA.Launcher/pull/%s', 'pull request #'), - 'ghsrc': ('https://GitHub.com/edaa-org/pyEDAA.Launcher/blob/main/%s', ''), + "gh": (f"https://GitHub.com/%s", "%s"), + "ghissue": (f"https://GitHub.com/{githubNamespace}/{project}/issues/%s", "issue #%s"), + "ghpull": (f"https://GitHub.com/{githubNamespace}/{project}/pull/%s", "pull request #%s"), + "ghsrc": (f"https://GitHub.com/{githubNamespace}/{project}/blob/main/%s", None), + "pypi": ('https://PyPI.org/project/%s', '%s'), + "wiki": (f"https://en.wikipedia.org/wiki/%s", None), } + + +# ============================================================================== +# Sphinx.Ext.Graphviz +# ============================================================================== +graphviz_output_format = "svg" + + +# ============================================================================== +# SphinxContrib.Mermaid +# ============================================================================== +mermaid_params = [ + '--backgroundColor', 'transparent', +] +mermaid_verbose = True + + +# ============================================================================== +# Sphinx.Ext.Inheritance_Diagram +# ============================================================================== +inheritance_node_attrs = { +# "shape": "ellipse", +# "fontsize": 14, +# "height": 0.75, + "color": "dodgerblue1", + "style": "filled" +} + + +# ============================================================================== +# Sphinx.Ext.ToDo +# ============================================================================== +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True +todo_link_only = True + + +# ============================================================================== +# sphinx-reports +# ============================================================================== +report_unittest_testsuites = { + "src": { + "name": f"{project}", + "xml_report": "../report/unit/TestReportSummary.xml", + } +} +report_codecov_packages = { + "src": { + "name": f"{project}", + "json_report": "../report/coverage/coverage.json", + "fail_below": 80, + "levels": "default" + } +} +report_doccov_packages = { + "src": { + "name": f"{project}", + "directory": f"../{directoryName}", + "fail_below": 80, + "levels": "default" + } +} + + +# ============================================================================== +# Sphinx_Design +# ============================================================================== +# sd_fontawesome_latex = True + + +# ============================================================================== +# AutoAPI.Sphinx +# ============================================================================== +autoapi_modules = { + f"{project}": { + "template": "module", + "output": project, + "override": True + } +} + +# for directory in [mod for mod in Path(f"../{project}").iterdir() if mod.is_dir() and mod.name != "__pycache__"]: +# print(f"Adding module rule for '{project}.{directory.name}'") +# autoapi_modules[f"{project}.{directory.name}"] = { +# "template": "module", +# "output": project, +# "override": True +# } diff --git a/doc/coverage/index.rst b/doc/coverage/index.rst new file mode 100644 index 0000000..bad51b9 --- /dev/null +++ b/doc/coverage/index.rst @@ -0,0 +1,7 @@ +Code Coverage Report +#################### + +Code coverage report generated with `pytest `__ and `Coverage.py `__. + +.. report:code-coverage:: + :packageid: src diff --git a/doc/index.rst b/doc/index.rst index ad6ebcc..2b6ac44 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -16,31 +16,170 @@ .. only:: html | |SHIELD:svg:Launcher-github| |SHIELD:svg:Launcher-ghp-doc| |SHIELD:svg:Launcher-gitter| - | |SHIELD:svg:Launcher-gha-test| + | |SHIELD:svg:Launcher-gha-test| |SHIELD:svg:Launcher-codacy-quality| -.. Disabled shields: |SHIELD:svg:Launcher-src-license| |SHIELD:svg:Launcher-doc-license| |SHIELD:svg:Launcher-pypi-tag| |SHIELD:svg:Launcher-pypi-status| |SHIELD:svg:Launcher-pypi-python| |SHIELD:svg:Launcher-lib-status| |SHIELD:svg:Launcher-codacy-quality| |SHIELD:svg:Launcher-codacy-coverage| |SHIELD:svg:Launcher-codecov-coverage| |SHIELD:svg:Launcher-lib-dep| |SHIELD:svg:Launcher-req-status| |SHIELD:svg:Launcher-lib-rank| +.. Disabled shields: |SHIELD:svg:Launcher-src-license| |SHIELD:svg:Launcher-doc-license| |SHIELD:svg:Launcher-pypi-tag| |SHIELD:svg:Launcher-pypi-status| |SHIELD:svg:Launcher-pypi-python| |SHIELD:svg:Launcher-lib-status| |SHIELD:svg:Launcher-codacy-coverage| |SHIELD:svg:Launcher-codecov-coverage| |SHIELD:svg:Launcher-lib-dep| |SHIELD:svg:Launcher-req-status| |SHIELD:svg:Launcher-lib-rank| .. only:: latex |SHIELD:png:Launcher-github| |SHIELD:png:Launcher-ghp-doc| |SHIELD:png:Launcher-gitter| - |SHIELD:png:Launcher-gha-test| + |SHIELD:png:Launcher-gha-test| |SHIELD:png:Launcher-codacy-quality| -.. Disabled shields: |SHIELD:png:Launcher-src-license| |SHIELD:png:Launcher-doc-license| |SHIELD:png:Launcher-pypi-tag| |SHIELD:png:Launcher-pypi-status| |SHIELD:png:Launcher-pypi-python| |SHIELD:png:Launcher-lib-status| |SHIELD:png:Launcher-codacy-quality| |SHIELD:png:Launcher-codacy-coverage| |SHIELD:png:Launcher-codecov-coverage| |SHIELD:png:Launcher-lib-dep| |SHIELD:png:Launcher-req-status| |SHIELD:png:Launcher-lib-rank| +.. Disabled shields: |SHIELD:png:Launcher-src-license| |SHIELD:png:Launcher-doc-license| |SHIELD:png:Launcher-pypi-tag| |SHIELD:png:Launcher-pypi-status| |SHIELD:png:Launcher-pypi-python| |SHIELD:png:Launcher-lib-status| |SHIELD:png:Launcher-codacy-coverage| |SHIELD:png:Launcher-codecov-coverage| |SHIELD:png:Launcher-lib-dep| |SHIELD:png:Launcher-req-status| |SHIELD:png:Launcher-lib-rank| The pyEDAA.Launcher Documentation ################################# -.. image:: _static/work-in-progress.png - :height: 275 px - :align: center - :target: https://GitHub.com/edaa-org/pyEDAA.Launcher +**pyEDAA.Launcher** starts the correct Xilinx Vivado version based on the version number written into the ``*.xpr`` file. +If no suitable version was found, an error message is shown. -.. raw:: html -
+.. _goals: + +Main Goals +********** + +When opening Xilinx Vivado by double-clicking an ``*.xpr`` file in the Windows Explorer, a default Vivado version is +launched by Windows. In many cases, this is the first Vivado version that was installed on a system, but not the latest +version. Anyhow, in most cases, Windows starts the wrong Vivado version, which leeds to a project upgrade question, or a +rejection, because the project file is too new. + +**pyEDAA.Launcher** addresses exactly this problem. It will start the correct Xilinx Vivado installation with correct +working directory settings, if that requested Vivado version is found on the system. + +How does it work? +================= + +1. Check with which Vivado version was used to save the ``*.xpr`` file. +2. Scan the Xilinx installation directory for available Vivado versions. +3. If a matching version was found, start Vivado and pass the ``*.xpr`` as a parameter. + +Differences to opening the ``*.xpr`` from within Vivado GUI? +============================================================ + +By default, Xilinx Vivado has its working directory in ``AppData``, but the working directory should be in the directory +where the ``*.xpr`` file is located. This is fixed by **pyEDAA.Launcher** as a side effect. Now, Vivado saves log and +journal files to the correct locations. + + +.. #_usecase: + + Use Cases + ********* + + * Handle multiple parallel Xilinx Vivado installations. + + +.. _news: + +News +**** + +.. only:: html + + Feb. 2022 - Documentation und Unit Test Enhancements + ==================================================== + +.. only:: latex + + .. rubric:: Documentation und Unit Test Enhancements + +* Updated documentation. +* Added simple unit tests. + + +.. only:: html + + Dec. 2021 - Initial Prototype + ============================= + +.. only:: latex + + .. rubric:: Initial Prototype + +* Development of a simple script to start the correct Vivado installation by reading the version from ``*.xpr`` file. + + +.. _CONTRIBUTORS: + +Contributors +************ + +* :gh:`Patrick Lehmann ` (Maintainer) +* :gh:`Stefan Unrein ` (Author) +* :gh:`Unai Martinez-Corral ` +* `and more... `__ + + +.. _LICENSE: + +License +******* + +.. only:: html + + This Python package (source code) is licensed under `Apache License 2.0 `__. |br| + The accompanying documentation is licensed under `Creative Commons - Attribution 4.0 (CC-BY 4.0) `__. + +.. only:: latex + + This Python package (source code) is licensed under **Apache License 2.0**. |br| + The accompanying documentation is licensed under **Creative Commons - Attribution 4.0 (CC-BY 4.0)**. .. toctree:: :hidden: Used as a layer of EDA² ➚ + + +.. toctree:: + :caption: Introduction + :hidden: + + Installation + Dependency + Usage + + +.. raw:: latex + + \part{Main Documentation} + +.. #toctree:: + :caption: Main Documentation + :hidden: + + LanguageModel/index + + +.. raw:: latex + + \part{References and Reports} + +.. toctree:: + :caption: References and Reports + :hidden: + + Python Class Reference + unittests/index + coverage/index + Doc. Coverage Report + Static Type Check Report ➚ + +.. Coverage Report ➚ + +.. raw:: latex + + \part{Appendix} + +.. toctree:: + :caption: Appendix + :hidden: + + License + Doc-License + Glossary + genindex + Python Module Index + TODO diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..922152e --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/make.ps1 b/doc/make.ps1 new file mode 100644 index 0000000..3bafa6f --- /dev/null +++ b/doc/make.ps1 @@ -0,0 +1,323 @@ +# .SYNOPSIS +# Please use '.\make.ps1 -' where is one of: +# html, dirhtml, singlehtml, pickle, json, linkcheck +# +# .DESCRIPTION +# This is a front-end script for Sphinx. +# +# .EXAMPLE +# .\make.ps1 -clean +# Cleanup the build directory. +# .EXAMPLE +# .\make.ps1 -html +# Build documentation as HTML pages. +# .EXAMPLE +# .\make.ps1 -clean -html -linkcheck +# Combine multiple commands in a single call +# +# +# ========================================================================== +# Copyright � 2016 Patrick Lehmann - Dresden, Germany +# ========================================================================== +[CmdletBinding()] +param( + # Make all targets + [switch]$all = $false, + # Extract VHDL documentation + [switch]$PoC = $false, + # Make standalone HTML files + [switch]$html = $false, + # Make HTML files named index.html in directories + [switch]$dirhtml = $false, + # Make a single large HTML file + [switch]$singlehtml = $false, + # Make a PDF file + [switch]$latex = $false, + [switch]$pdf = $false, + # Make pickle files + [switch]$pickle = $false, + # Make json files + [switch]$json = $false, + # Check all external links for integrity + [switch]$linkcheck = $false, + # Clean up directory before running Sphinx. + [switch]$changes = $false, + # Show changed files. + [switch]$clean = $false, + [switch]$cleanup = $false, + # Show the embedded help page(s). + [switch]$help = $false +) + +# resolve paths +$WorkingDir = Get-Location +$SphinxRootDir = Convert-Path (Resolve-Path ($PSScriptRoot)) + +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + +# Display help if no command was selected +$Help = $Help -or (-not ($all -or $PoC -or $html -or $dirhtml -or $singlehtml -or $latex -or $pdf -or $json -or $pickle -or $linkcheck -or $changes -or $clean -or $help)) + +function Exit-Script +{ <# + .PARAMETER ExitCode + ExitCode of this script run + #> + [CmdletBinding()] + param([int]$ExitCode = 0) + + # restore environment + # rm env:GHDL -ErrorAction SilentlyContinue + + cd $WorkingDir + + # unload modules + # Remove-Module precompile -Verbose:$false + + Pop-EnvironmentBlock + # exit with exit code + exit $ExitCode +} + +if ($Help) +{ Get-Help $MYINVOCATION.InvocationName -Detailed + Exit-Script +} + +Push-EnvironmentBlock +$env:Path += ";C:\Tools\Graphviz\2.38\bin" + +if ($PoC) +{ cd "$SphinxRootDir" + py -3 poc.py + Write-Host "Complete" -Foreground Green +} + +if ($All) +{ $clean = $true + $html = $true + $dirhtml = $true + $singlehtml = $true +} + +$SphinxBuild = if (-not $env:SPHINXBUILD) { "sphinx-build" } else { $env:SPHINXBUILD } +# $BuildDir = "$SphinxRootDir\{{ rbuilddir }}" +# $SourceDir = "$SphinxRootDir\{{ rsrcdir }}" +$BuildDir = "$SphinxRootDir\_build" # for local testing, can be removed in the future +$SourceDir = "$SphinxRootDir\." # for local testing, can be removed in the future +$AllSphinxOpts = "-d $BuildDir\doctrees ${env:SPHINXOPTS} $SourceDir" +$I18NSphinxOpts = "${env:SPHINXOPTS} $SourceDir" +# ------------------------------------------------------------------------------ +# TODO: add paper options +# ------------------------------------------------------------------------------ +# if NOT "%PAPER%" == "" ( +# set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +# set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +# ) + +# Check if sphinx-build is available and fallback to Python version if any +# ------------------------------------------------------------------------------ +# TODO: add testings if sphinxbuild can be called and/or is installed +# ------------------------------------------------------------------------------ +# %SPHINXBUILD% 1>NUL 2>NUL +# if errorlevel 9009 goto sphinx_python +# goto sphinx_ok +# +# :sphinx_python +# +# set SPHINXBUILD=python -m sphinx.__init__ +# %SPHINXBUILD% 2> nul +# if errorlevel 9009 ( +# echo. +# echo.The 'sphinx-build' command was not found. Make sure you have Sphinx +# echo.installed, then set the SPHINXBUILD environment variable to point +# echo.to the full path of the 'sphinx-build' executable. Alternatively you +# echo.may add the Sphinx directory to PATH. +# echo. +# echo.If you don't have Sphinx installed, grab it from +# echo.http://sphinx-doc.org/ +# exit /b 1 +# ) + + +if ($clean) +{ $EnableVerbose -and (Write-Host "Cleaning build directory '$BuildDir'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " dir -Path $BuildDir * -Directory | rmdir -Recurse" ) | Out-Null + if (Test-Path $BuildDir) + { dir -Path $BuildDir * -Directory | rmdir -Recurse } + + $EnableVerbose -and (Write-Host "Cleaning autoapi directory '$SphinxRootDir\PyInfrastructure'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " dir -Path $SphinxRootDir\PyInfrastructure *.rst | ? {$_.FullName -NotMatch 'index.rst'} | rmdir -Recurse" ) | Out-Null + dir -Path $SphinxRootDir\PyInfrastructure *.rst | ? {$_.FullName -NotMatch 'index.rst'} | rmdir -Recurse + + Write-Host "Cleaning finished." -Foreground Green +} + +if ($pickle) +{ $expr = "$SphinxBuild -b pickle $AllSphinxOpts $BuildDir\pickle" + $EnableVerbose -and (Write-Host "Building target 'pickle' into '$BuildDir\pickle'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. Now you can process the pickle files." -Foreground Green +} + +if ($html) +{ $expr = "$SphinxBuild -b html" + $expr += " -t PoCInternal" + if ($cleanup) + { $expr += " -t PoCCleanUp" } + + $expr += " $AllSphinxOpts $BuildDir\html" + $EnableVerbose -and (Write-Host "Building target 'html' into '$BuildDir\html'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML pages are in $BuildDir\html." -Foreground Green +} + +if ($dirhtml) +{ $expr = "$SphinxBuild -b dirhtml $AllSphinxOpts $BuildDir\dirhtml" + $EnableVerbose -and (Write-Host "Building target 'dirhtml' into '$BuildDir\dirhtml'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML pages are in $BuildDir\dirhtml." -Foreground Green +} + +if ($singlehtml) +{ $expr = "$SphinxBuild -b singlehtml $AllSphinxOpts $BuildDir\singlehtml" + $EnableVerbose -and (Write-Host "Building target 'singlehtml' into '$BuildDir\singlehtml'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML file is in $BuildDir\singlehtml." -Foreground Green +} + +if ($latex) +{ $expr = "$SphinxBuild -b latex $AllSphinxOpts $BuildDir\pdf" + $EnableVerbose -and (Write-Host "Building target 'latex' into '$BuildDir\pdf'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The LaTeX sources are in $BuildDir\pdf." -Foreground Green +} +if ($pdf) +{ cd "$BuildDir\pdf" + + # Write-Host "Patching LaTeX file..." -Foreground Yellow + # $strippedFileContent = "" + # $state = 0 + # foreach ($line in (cat "$BuildDir\pdf\ThePoC-Library.tex" -Encoding UTF8)) + # { if ($state -lt 3) + # { if ($line.StartsWith("\ifPDFTeX")) + # { $state = 1 + # $strippedFileContent += "\usepackage[utf8]{inputenc}`r`n\ifdefined\DeclareUnicodeCharacter`r`n \DeclareUnicodeCharacter{00A0}{\nobreakspace}`r`n \DeclareUnicodeCharacter{2265}{$\geq$}`r`n \DeclareUnicodeCharacter{21D2}{$\Rightarrow$}`r`n\fi`r`n" + # continue + # } + # elseif ($line.StartsWith("\fi")) + # { $state += 1 + # continue + # } + # if ($state -eq 0) + # { $strippedFileContent += $line + "`r`n" } + # } + # else + # { $strippedFileContent += $line + "`r`n" } + # } + # $strippedFileContent | Out-File "$BuildDir\pdf\The-PoC-Library.tex" -Encoding UTF8 + # Write-Host "Patching finished. The new LaTeX file is in $BuildDir\pdf." -Foreground Green + + cp "$BuildDir\pdf\ThePoC-Library.tex" "$BuildDir\pdf\The-PoC-Library.tex" + + $expr = "pdflatex.exe $BuildDir\pdf\The-PoC-Library.tex" + $EnableVerbose -and (Write-Host "Building target 'pdf' into '$BuildDir\pdf'..." -Foreground DarkCyan ) | Out-Null + Write-Host "Compiling with pdflatex.exe..." -Foreground Yellow + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + + $expr = "makeindex.exe .\The-PoC-Library.idx" + Write-Host "Creating index with makeindex.exe..." -Foreground Yellow + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + + $expr = "pdflatex.exe $BuildDir\pdf\The-PoC-Library.tex" + Write-Host "Compiling with pdflatex.exe..." -Foreground Yellow + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The PDF file is in $BuildDir\pdf." -Foreground Green +} + +if ($json) +{ $expr = "$SphinxBuild -b json $AllSphinxOpts $BuildDir\json" + $EnableVerbose -and (Write-Host "Building target 'json' into '$BuildDir\json'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. Now you can process the json files." -Foreground Green +} + +if ($linkcheck) +{ $expr = "$SphinxBuild -b linkcheck $AllSphinxOpts $BuildDir\linkcheck" + $EnableVerbose -and (Write-Host "Building target 'html' into '$BuildDir\html'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Link check complete. Look for any errors in the above output or in $BuildDir\linkcheck\output.txt." -Foreground Green +} + +if ($changes) +{ $expr = "$SphinxBuild -b changes $AllSphinxOpts $BuildDir\changes" + $EnableVerbose -and (Write-Host "Building target 'changes' into '$BuildDir\changes'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Searching for changes complete. Look for any errors in the above output or in $BuildDir\changes\output.txt." -Foreground Green +} + +if ($PoC) +{ cd "$SphinxRootDir" + Write-Host "Expanding labels..." -Foreground Yellow + py -3 ..\temp\sphinx\inventory.py --file _build\html\objects.inv --rst > ..\temp\sphinx\PoC.inventory.rst + + Write-Host "Stripping file from Python labels..." -Foreground Yellow + $strippedFileContent = "" + $skip = $false + foreach ($line in (cat ..\temp\sphinx\PoC.inventory.rst -Encoding UTF8)) + { if ($line -match "^`t:py:(exception|class|classmethod|staticmethod|module|function|method|prefix):\w") + { $skip = $true + # Write-Host "$line" -Foreground Gray + continue + } + if ($line -match "^`t`t:Title:`t-") + { $skip = $false + # Write-Host "$line" -Foreground DarkCyan + continue + } + if (-not $skip) + { $strippedFileContent += $line + "`r`n" + } + } + $strippedFileContent | Out-File ..\temp\sphinx\PoC.stripped.rst -Encoding UTF8 + Write-Host "Complete" -Foreground Green +} + +Exit-Script diff --git a/doc/prolog.inc b/doc/prolog.inc new file mode 100644 index 0000000..75463a8 --- /dev/null +++ b/doc/prolog.inc @@ -0,0 +1,59 @@ +.. # Load pre-defined aliases and graphical characters like © from docutils + # is used to denote the special path + # \Lib\site-packages\docutils\parsers\rst\include +.. include:: +.. include:: + +.. # define a hard line break for HTML +.. |br| raw:: html + +
+ +.. # define horizontal line for HTML +.. |hr| raw:: html + +
+ +.. # define additional CSS based styles and ReST roles for HTML +.. raw:: html + + + +.. role:: bolditalic + :class: bolditalic + +.. role:: underline + :class: underline + +.. role:: strike + :class: strike + +.. role:: xlarge + :class: xlarge + +.. role:: red + :class: colorred +.. role:: green + :class: colorgreen +.. role:: blue + :class: colorblue +.. role:: purple + :class: colorpurple + +.. role:: deletion + :class: colorred strike +.. role:: addition + :class: colorgreen + +.. role:: pycode(code) + :language: python + :class: highlight diff --git a/doc/pyEDAA.Launcher/index.rst b/doc/pyEDAA.Launcher/index.rst new file mode 100644 index 0000000..83f250a --- /dev/null +++ b/doc/pyEDAA.Launcher/index.rst @@ -0,0 +1,8 @@ +Python Class Reference +###################### + +Reference of all packages and modules: + +.. toctree:: + + pyEDAA.Launcher diff --git a/doc/requirements.txt b/doc/requirements.txt index 6966869..bfb8bf1 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1 +1,17 @@ -sphinx +-r ../requirements.txt + +# Enforce latest version on ReadTheDocs +sphinx ~= 8.1 +docutils ~= 0.21 +docutils_stubs ~= 0.0.22 + +# ReadTheDocs Theme +sphinx_rtd_theme ~= 3.0.0 + +# Sphinx Extenstions +sphinxcontrib-mermaid ~= 1.0 +autoapi >= 2.0.1 +sphinx_design ~= 0.6.1 +sphinx-copybutton >= 0.5.2 +sphinx_autodoc_typehints ~= 2.5 +sphinx_reports ~= 0.7 diff --git a/doc/shields.inc b/doc/shields.inc index 747dfab..6fdc154 100644 --- a/doc/shields.inc +++ b/doc/shields.inc @@ -74,21 +74,21 @@ :target: https://GitHub.com/edaa-org/pyEDAA.Launcher/actions/workflows/Pipeline.yml .. # Codacy - quality -.. |SHIELD:svg:Launcher-codacy-quality| image:: https://img.shields.io/codacy/grade/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy +.. |SHIELD:svg:Launcher-codacy-quality| image:: https://img.shields.io/codacy/grade/83936550d5094383bb89bb117c0abbfe?longCache=true&style=flat-square&logo=codacy :alt: Codacy - Quality :height: 22 :target: https://www.codacy.com/gh/edaa-org/pyEDAA.Launcher -.. |SHIELD:png:Launcher-codacy-quality| image:: https://raster.shields.io/codacy/grade/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy +.. |SHIELD:png:Launcher-codacy-quality| image:: https://raster.shields.io/codacy/grade/83936550d5094383bb89bb117c0abbfe?longCache=true&style=flat-square&logo=codacy :alt: Codacy - Quality :height: 22 :target: https://www.codacy.com/gh/edaa-org/pyEDAA.Launcher .. # Codacy - coverage -.. |SHIELD:svg:Launcher-codacy-coverage| image:: https://img.shields.io/codacy/coverage/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy +.. |SHIELD:svg:Launcher-codacy-coverage| image:: https://img.shields.io/codacy/coverage/83936550d5094383bb89bb117c0abbfe?longCache=true&style=flat-square&logo=codacy :alt: Codacy - Line Coverage :height: 22 :target: https://www.codacy.com/gh/edaa-org/pyEDAA.Launcher -.. |SHIELD:png:Launcher-codacy-coverage| image:: https://raster.shields.io/codacy/coverage/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy +.. |SHIELD:png:Launcher-codacy-coverage| image:: https://raster.shields.io/codacy/coverage/83936550d5094383bb89bb117c0abbfe?longCache=true&style=flat-square&logo=codacy :alt: Codacy - Line Coverage :height: 22 :target: https://www.codacy.com/gh/edaa-org/pyEDAA.Launcher diff --git a/doc/typing/index.rst b/doc/typing/index.rst new file mode 100644 index 0000000..97d4ae2 --- /dev/null +++ b/doc/typing/index.rst @@ -0,0 +1,4 @@ +Static Type Checking Report +########################### + +*Placeholder for the Static Type Checking report generated with* ``mypy``. diff --git a/doc/unittests/index.rst b/doc/unittests/index.rst new file mode 100644 index 0000000..8b840ee --- /dev/null +++ b/doc/unittests/index.rst @@ -0,0 +1,7 @@ +Unittest Summary Report +####################### + +Unittest report generated with `pytest `__. + +.. report:unittest-summary:: + :reportid: src diff --git a/pyEDAA/Launcher/__init__.py b/pyEDAA/Launcher/__init__.py new file mode 100644 index 0000000..ceda82e --- /dev/null +++ b/pyEDAA/Launcher/__init__.py @@ -0,0 +1,189 @@ +# ==================================================================================================================== # +# _____ ____ _ _ _ _ # +# _ __ _ _| ____| _ \ / \ / \ | | __ _ _ _ _ __ ___| |__ ___ _ __ # +# | '_ \| | | | _| | | | |/ _ \ / _ \ | | / _` | | | | '_ \ / __| '_ \ / _ \ '__| # +# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| |__| (_| | |_| | | | | (__| | | | __/ | # +# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_____\__,_|\__,_|_| |_|\___|_| |_|\___|_| # +# |_| |___/ # +# ==================================================================================================================== # +# Authors: # +# Stefan Unrein # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2021-2024 Stefan Unrein - Endingen, Germany # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Start the correct Vivado Version based on version in `*.xpr`file.""" +__author__ = "Stefan Unrein" +__email__ = "stefan.unrein@gmx.net" +__copyright__ = "2021-2024, Stefan Unrein" +__license__ = "Apache License, Version 2.0" +__version__ = "0.1.0" +__keywords__ = ["launcher", "version selector", "xilinx", "vivado"] + +from re import compile as re_compile + +from sys import exit, argv +import subprocess +from pathlib import Path +from textwrap import dedent +from time import sleep +from typing import NoReturn, Generator + +from pyTooling.Decorators import export + + +@export +class Program: + """Program instance of pyEDAA.Launcher.""" + + vivadoBatchfile = Path("bin/vivado.bat") + vvglWrapperFile = Path("bin/unwrapped/win64.o/vvgl.exe") + + versionLineRegExp = re_compile(r"^") + + _projectFilePath: Path + + + def __init__(self, projectFilePath: Path) -> None: + """Initializer. + + :param projectFilePath: Path to the ``*.xpr`` file. + :raises Exception: When the given ``*.xpr`` file doesn't exist. + """ + if not projectFilePath.exists(): + raise Exception(f"Vivado project file '{projectFilePath}' not found.") \ + from FileNotFoundError(f"File '{projectFilePath}' not found.") + + self._projectFilePath = projectFilePath + + def GetVersion(self) -> str: + """Opens an ``*.xpr`` file and returns the Vivado version used to save this file. + + :returns: Used Vivado version to save the given ``*.xpr`` file. + :raises Exception: When the version information isn't found in the file. + """ + with self._projectFilePath.open("r", encoding="utf-8") as file: + for line in file: + match = self.versionLineRegExp.match(line) + if match is not None: + return f"{match['major']}.{match['minor']}" + else: + raise Exception(f"Pattern not found in '{self._projectFilePath}'.") + + @classmethod + def GetVivadoVersions(self, installPath: Path) -> Generator[str, None, None]: + """Scan a given directory for installed Vivado versions. + + :param installPath: Xilinx installation directory. + :returns: A generator for a sequence of installed Vivado versions. + """ + for item in installPath.iterdir(): + if item.is_dir(): + yield item.name + + def StartVivado(self, xilinxInstallationPath: Path, version: str) -> NoReturn: + """Start the given Vivado version with an ``*.xpr`` file as parameter. + + :param xilinxInstallationPath: Path to the Xilinx toolchain installations. + :param version: The Vivado version to start. + """ + vivadoInstallationPath = xilinxInstallationPath / version + + vvglWrapperPath = vivadoInstallationPath / self.vvglWrapperFile + vivadoBatchfilePath = vivadoInstallationPath / self.vivadoBatchfile + + cmd = [str(vvglWrapperPath), str(vivadoBatchfilePath), str(self._projectFilePath)] + subprocess.Popen(cmd, cwd=self._projectFilePath.parent) # , creationflags=subprocess.DETACHED_PROCESS) + + print("") + print(f"Opening project with Vivado {version}.") + + sleep(2) + exit(0) + + @classmethod + def PrintHelp(cls, scriptPath: Path) -> None: + """Print a help page. + + :param scriptPath: Path to this script. + """ + print(dedent(f"""\ + Run-Path '{scriptPath}' + + For using this Launcher, please bind the *.xpr file extension to this executable with: + * Put this executable into the Vivado installation folder. E.g: C:\\Xilinx\\Vivado\\ + * Change *.xpr association: right-click -> open with -> VivadoManager.exe + """)) + + +@export +def main() -> NoReturn: + """Entry point function. + + It creates an instance of :class:`Program` and hands over the execution to the OOP world. + """ + xilinxInstallationPath = Path.cwd() + scriptPath = Path(argv[0]) + + if (argc := len(argv)) == 0: + Program.PrintHelp(scriptPath) + + print(f"Current path '{xilinxInstallationPath}' contains the following folders:") + for version in Program.GetVivadoVersions(xilinxInstallationPath): + print(f"* {version}") + + print("") + print("Press any key to exit.") + + # wait on user interaction + input() + exit(0) + + elif argc == 1: + projectFileArgument = argv[1] + projectFilePath = Path(projectFileArgument) + + program = Program(projectFilePath) + + try: + versionFromXPRFile = program.GetVersion() + except Exception as ex: + print(f"[ERROR] {ex}") + exit(1) + + for version in program.GetVivadoVersions(xilinxInstallationPath): + if version == versionFromXPRFile: + program.StartVivado(xilinxInstallationPath, versionFromXPRFile) + else: + vivadoPath = xilinxInstallationPath / versionFromXPRFile + print(dedent(f"""\ + ERROR: Vivado version {versionFromXPRFile} not available at path '{vivadoPath}'. Please start manually! + + Press any key to exit. + """)) + + # wait on user interaction + input() + exit(1) + + +# Entry point +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c68d6f0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,76 @@ +[build-system] +requires = [ + "setuptools ~= 75.5", + "wheel ~= 0.45", + "pyTooling ~= 8.0" +] +build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 120 + +[tool.mypy] +files = ["pyEDAA.Launcher"] +python_version = "3.13" +#ignore_missing_imports = true +strict = true +pretty = true +show_error_context = true +show_error_codes = true +namespace_packages = true +html_report = "report/typing" + +[tool.pytest.ini_options] +addopts = "--tb=native" +# Don't set 'python_classes = *' otherwise, pytest doesn't search for classes +# derived from unittest.Testcase +python_files = "*" +python_functions = "test_*" +filterwarnings = [ + "error::DeprecationWarning", + "error::PendingDeprecationWarning" +] +junit_logging = "all" + +[tool.interrogate] +color = true +verbose = 1 # possible values: 0 (minimal output), 1 (-v), 2 (-vv) +fail-under = 59 +exclude = [ + "build", + "dist", + "doc", + "tests", + "setup.py" +] +ignore-setters = true + +[tool.coverage.run] +branch = true +relative_files = true +omit = [ + "*site-packages*", + "setup.py", + "tests/unit/*" +] + +[tool.coverage.report] +skip_covered = false +skip_empty = true +exclude_lines = [ + "pragma: no cover", + "raise NotImplementedError" +] +omit = [ + "tests/*" +] + +[tool.coverage.xml] +output = "report/coverage/coverage.xml" + +[tool.coverage.json] +output = "report/coverage/coverage.json" + +[tool.coverage.html] +directory = "report/coverage/html" +title="Code Coverage of pyEDAA.Launcher" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4db3549 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyTooling ~= 8.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..49b8f7b --- /dev/null +++ b/setup.py @@ -0,0 +1,57 @@ +# ==================================================================================================================== # +# _____ ____ _ _ _ _ # +# _ __ _ _| ____| _ \ / \ / \ | | __ _ _ _ _ __ ___| |__ ___ _ __ # +# | '_ \| | | | _| | | | |/ _ \ / _ \ | | / _` | | | | '_ \ / __| '_ \ / _ \ '__| # +# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| |__| (_| | |_| | | | | (__| | | | __/ | # +# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_____\__,_|\__,_|_| |_|\___|_| |_|\___|_| # +# |_| |___/ # +# ==================================================================================================================== # +# Authors: # +# Stefan Unrein # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2021-2024 Stefan Unrein - Endingen, Germany # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Package installer for 'Start the correct Vivado Version based on version in ``*.xpr`` file.'.""" +from setuptools import setup + +from pathlib import Path +from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub, DEFAULT_CLASSIFIERS + +gitHubNamespace = "edaa-org" +packageName = "pyEDAA.Launcher" +packageDirectory = packageName.replace(".", "/") +packageInformationFile = Path(f"{packageDirectory}/__init__.py") + +setup(**DescribePythonPackageHostedOnGitHub( + packageName=packageName, + description="Start the correct Vivado Version based on version in '*.xpr' file.", + gitHubNamespace=gitHubNamespace, + sourceFileWithVersion=packageInformationFile, + developmentStatus="beta", + classifiers=list(DEFAULT_CLASSIFIERS) + [ + "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", + ], + dataFiles={ + packageName: ["py.typed"] + }, + consoleScripts={ + "pyedaa-launcher": "pyEDAA.Launcher:main" + } +)) diff --git a/tests/StopWatch.xpr b/tests/StopWatch.xpr new file mode 100644 index 0000000..a94e6ab --- /dev/null +++ b/tests/StopWatch.xpr @@ -0,0 +1,249 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + default_dashboard + + + diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..2ad659b --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,13 @@ +-r ../requirements.txt + +# Coverage collection +Coverage ~= 7.6 + +# Test Runner +pytest ~= 8.3 +pytest-cov ~= 6.0 + +# Static Type Checking +mypy ~= 1.13 +typing_extensions ~= 4.12 +lxml ~= 5.3 diff --git a/tests/unit/Vivado.py b/tests/unit/Vivado.py new file mode 100644 index 0000000..e8a4fc1 --- /dev/null +++ b/tests/unit/Vivado.py @@ -0,0 +1,44 @@ +# ==================================================================================================================== # +# _____ ____ _ _ _ _ # +# _ __ _ _| ____| _ \ / \ / \ | | __ _ _ _ _ __ ___| |__ ___ _ __ # +# | '_ \| | | | _| | | | |/ _ \ / _ \ | | / _` | | | | '_ \ / __| '_ \ / _ \ '__| # +# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| |__| (_| | |_| | | | | (__| | | | __/ | # +# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_____\__,_|\__,_|_| |_|\___|_| |_|\___|_| # +# |_| |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2017-2024 Patrick Lehmann - Bötzingen, Germany # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Unit tests for Vivado.""" +from pathlib import Path +from unittest import TestCase + +from pyEDAA.Launcher import Program + + +class ReadXPRFile(TestCase): + def test_ExtractVersionFromXPRFile(self) -> None: + xprFilePath = Path("tests/StopWatch.xpr") + program = Program(xprFilePath) + version = program.GetVersion() + + self.assertEqual("2021.2", version) diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..b4f51ce --- /dev/null +++ b/tests/unit/__init__.py @@ -0,0 +1,31 @@ +# ==================================================================================================================== # +# _____ ____ _ _ _ _ # +# _ __ _ _| ____| _ \ / \ / \ | | __ _ _ _ _ __ ___| |__ ___ _ __ # +# | '_ \| | | | _| | | | |/ _ \ / _ \ | | / _` | | | | '_ \ / __| '_ \ / _ \ '__| # +# | |_) | |_| | |___| |_| / ___ \ / ___ \ _| |__| (_| | |_| | | | | (__| | | | __/ | # +# | .__/ \__, |_____|____/_/ \_\/_/ \_(_)_____\__,_|\__,_|_| |_|\___|_| |_|\___|_| # +# |_| |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2017-2024 Patrick Lehmann - Bötzingen, Germany # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Helper classes for unit tests.""" diff --git a/tests/unit/requirements.txt b/tests/unit/requirements.txt new file mode 100644 index 0000000..3c8d7e7 --- /dev/null +++ b/tests/unit/requirements.txt @@ -0,0 +1 @@ +-r ../requirements.txt