|
| 1 | +# Utils |
| 2 | + |
| 3 | +# Generate THIRD-PARTY.md fromuser inputs |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python 3.8 |
| 8 | + |
| 9 | +## Description |
| 10 | + |
| 11 | +Sometimes as open source referent or developer, we need to define file listing third-party components. |
| 12 | +This type of file must contain, for eeach component, its name, cipyright, license (wih URL pointing to its text) and also the version and the copyright owners. |
| 13 | +It can be a bit broing to fill each time the text or markdown file, that is the reason why this tool has been defined. |
| 14 | + |
| 15 | +### Ask inputs from user |
| 16 | + |
| 17 | +A first script will ask the user for details about the components he or she wants to add in the final THIRD-PARTY file. |
| 18 | +To do that: |
| 19 | +```shell |
| 20 | +python3.8 third-party-prompt.py |
| 21 | +``` |
| 22 | + |
| 23 | +This Python script will first check if some previous file still exists, i.e. if previous data can be reused (because the operation was paused before). |
| 24 | +If the file exists, the script will prompt the user to keep or get rid of it (default). |
| 25 | +Once the script completes, a local CSV file must appear or be updated (named *components.csv.result*). |
| 26 | + |
| 27 | +### Generate the THIRD-PARTY file |
| 28 | + |
| 29 | +Then once some CSV file exists, defined thanks to the previous script or for example given by someone else who already made a list, the other script can be used |
| 30 | +so as to iterate on each component and build the final Markdown file. |
| 31 | + |
| 32 | +```shell |
| 33 | +# --file: the path to the CSV file containing the details |
| 34 | +# --delimiter: to define how to split each row fields. Do not forget to escape it if ';' |
| 35 | +python3.8 third-party-generator.py --file components.csv.result --delimiter \; |
| 36 | +``` |
| 37 | + |
| 38 | +### About the CSV file |
| 39 | + |
| 40 | +The CSV file produced by the script *third-party-prompt.py* or processed by *third-party-generator.py* must follow the format above: |
| 41 | + |
| 42 | +```csv |
| 43 | +name;repository;licenseName;copyright;version |
| 44 | +``` |
| 45 | + |
| 46 | +Meaning: |
| 47 | +- ";" symbol as delimiter |
| 48 | +- name: the name of the component |
| 49 | +- repository: the hyperlink to the repository to get the sources for the readers |
| 50 | +- licenseName: the name of the license in SPDX short-identifier (cf *licenses.py*) |
| 51 | +- copyright: the copyright owners |
| 52 | +- version: the verison of the component |
| 53 | + |
| 54 | + |
| 55 | +For example, with the CSV file bellow |
| 56 | +```csv |
| 57 | +SwiftUI-Flow;https://github.com/tevelee/SwiftUI-Flow;MIT;Copyright (c) 2023 Laszlo Teveli;1.2.0 |
| 58 | +BottomSheet;https://github.com/lucaszischka/BottomSheet;MIT;Copyright (c) 2021-2022 Lucas Zischka;3.1.1 |
| 59 | +DeclarationAccessibility;https://github.com/Orange-OpenSource/accessibility-statement-lib-ios;Apache-2.0;Copyright (c) 2021-2023 Orange SA;1.2.0 |
| 60 | +``` |
| 61 | + |
| 62 | +the produced Markdown (called *THIRD-PARTY.md.result*) will be: |
| 63 | +```markdown |
| 64 | +\# Third Party Softwares |
| 65 | + |
| 66 | +This document contains the list of Third Party Softwares along with the license information. |
| 67 | + |
| 68 | +Third Party Software may impose additional restrictions and it is the user's responsibility to ensure that they have met the licensing |
| 69 | +requirements of the relevant license of the Third Party Software they are using. |
| 70 | + |
| 71 | +\## SwiftUI-Flow |
| 72 | + |
| 73 | +Version 1.2.0 |
| 74 | + |
| 75 | +Copyright Copyright (c) 2023 Laszlo Teveli |
| 76 | + |
| 77 | +**SwiftUI-Flow** is distributed under the terms and conditions of the [MIT License](https://opensource.org/license/mit). |
| 78 | +You may download the source code on the [following website](https://github.com/tevelee/SwiftUI-Flow). |
| 79 | + |
| 80 | + |
| 81 | +\## BottomSheet |
| 82 | + |
| 83 | +Version 3.1.1 |
| 84 | + |
| 85 | +Copyright Copyright (c) 2021-2022 Lucas Zischka |
| 86 | + |
| 87 | +**BottomSheet** is distributed under the terms and conditions of the [MIT License](https://opensource.org/license/mit). |
| 88 | +You may download the source code on the [following website](https://github.com/lucaszischka/BottomSheet). |
| 89 | + |
| 90 | + |
| 91 | +\## DeclarationAccessibility |
| 92 | + |
| 93 | +Version 1.2.0 |
| 94 | + |
| 95 | +Copyright Copyright (c) 2021-2023 Orange SA |
| 96 | + |
| 97 | +**DeclarationAccessibility** is distributed under the terms and conditions of the [Apache-2.0 License](https://opensource.org/license/apache-2-0). |
| 98 | +You may download the source code on the [following website](https://github.com/Orange-OpenSource/accessibility-statement-lib-ios). |
| 99 | +``` |
| 100 | + |
| 101 | +### About the licenses.py file |
| 102 | + |
| 103 | +There is plenty of licenses and also a lot of standards. It can be a pain or time consuming to let the user write the license in use for a component, |
| 104 | +then find there URL point to the license text and write it. In fact, such details are still known so we can let the user choose. |
| 105 | +The *licenses.py* file lists main licenses we can meet during audits. Each entry in this dictionary has a license name in SPDX short-identifier format and the URL pointing to the license text. Thus these details will be added in the THIRD-PARTY file.$ |
0 commit comments