Package Metadata/pl

Wprowadzenie
Począwszy od wersji 0.20 programu FreeCAD, zewnętrzne dodatki (środowiska pracy, makra i pakiety preferencji) mogą być dystrybuowane z plikiem metadanych opisującym zawartość pakietu. Jeżeli plik "package.xml" jest obecny, jest on odczytywany przez FreeCAD i jego zawartość jest wykorzystywana w różnych częściach interfejsu użytkownika. Obecnie jest on opcjonalny dla środowisk pracy i makrodefinicji, a wymagany dla pakietów preferencji. Ta strona dokumentuje format tego pliku metadanych. Format (i zawartość tej strony Wiki) są oparte na REP 149.



Ogólny format pliku
Ten dokument opisuje obecnie format pliku w wersji 1.

Plik metadanych musi być prawidłowym, dobrze uformowanym dokumentem XML 1.0. Musi on nosić nazwę "package.xml" i musi istnieć w katalogu bazowym głównej gałęzi pakietu oprogramowania (jak określono w pliku FreeCAD-addons .gitmodules) w jego repozytorium git. Tylko plik package.xml z głównej gałęzi jest brany pod uwagę przez Menadżera dodatków. Wszystkie zrozumiałe znaczniki XML są pisane małymi literami, ale nierozpoznane znaczniki nie stanowią błędu. Większość znaczników jest opcjonalna, a niektóre mają zastosowanie tylko do niektórych typów zawartości pakietów (na przykład, tylko środowiska pracy zapewniają obecnie element "classname"). Niepotrzebne lub nierozpoznane elementy są ignorowane.

Każda ścieżka pliku określona w package.xml musi używać ukośnika ("/") jako separatora katalogu: w systemach, które oczekują innego separatora podczas wykonywania (np. Windows) FreeCAD automatycznie przekonwertuje go na prawidłowy separator.



Jedynym dozwolonym elementem najwyższego poziomu jest, a plik może zawierać tylko jeden element. Bezpośrednio pod nim znajduje się kilka wymaganych lub opcjonalnych elementów, zdefiniowanych tutaj. Żadne inne znaczniki nie są dozwolone bezpośrednio pod elementem.



Znacznik jest unikalnym znacznikiem najwyższego poziomu w pliku package.xml. Wszystkie inne znaczniki są zagnieżdżone pod nim.

Atrybuty

 * format="NUMBER": Określenie używanego formatu package.xml. Dla tego interfejsu należy określić format="1".
 * xmlns="NAMESPACE": Określa przestrzeń nazw XML dla tego pakietu i musi być dołączona dokładnie tak, jak pokazano powyżej, jako link do https://wiki.freecad.org/Package_Metadata.



Wymagane identyfikatory podrzędne
Element najwyższego poziomu musi zawierać co najmniej następujące znaczniki:


 * 
 * 
 * 
 * 
 * (wiele, ale co najmniej jeden)
 * (wiele, ale co najmniej jeden)
 * 
 * (element kontenera dla elementów zawartości pakietu)



Opcjonalne identyfikatory podrzędne

 * (wiele)
 * (wiele)
 * (wiele)
 * (wiele)
 * (wiele)
 * (wiele)
 * 
 * 
 * 

WYMAGANE

Nazwa tego pakietu. Musi zawierać tylko znaki, które są prawidłowe dla nazw plików (niedozwolone znaki to /\?%*:|"<> ).

WYMAGANE

Numer wersji zgodny ze standardem semantic versioning 2.0 (np. 1.0.2-beta) lub CalVer style (np. 2021.12.08). Należy pamiętać, że nie można dołączyć obu typów, a przełączanie między typami nie jest obsługiwane. Wewnętrznie kod nie ma pojęcia, który typ został wybrany, podczas porównywania wersji wykonuje proste porównanie numeryczne między każdym kolejnym składnikiem numerycznym, niezależnie od typu. Należy pamiętać, że nie można pozostawić tego pola pustego, należy przypisać jakiś numer wersji. Gdy Menedżer dodatków wykryje podwyższenie numeru wersji, wyświetli użytkownikom informację "dostępna aktualizacja".

WYMAGANE

Data bieżącej wersji, w formacie RRRR-MM-DD lub RRRR.MM.DD.

WYMAGANE

Zwięzły (do kilku zdań) tekstowy opis tego pakietu. Nie są obsługiwane żadne znaczniki.

CO NAJMNIEJ JEDEN WYMAGANY (dopuszczalna jest większa liczba)

Imię i nazwisko osoby opiekującej się pakietem. Wszystkie pakiety wymagają opiekuna. Dla osieroconych pakietów patrz uwagi poniżej.

Atrybuty

 * email="name@domain.tld" (wymagane): Adres e-mail opiekuna.

Osierocony pakiet to taki, który nie ma aktualnego opiekuna. Osierocone pakiety powinny używać następujących informacji o opiekunie:

No current maintainer

AT LEAST ONE REQUIRED (multiple allowed)

SPDX short identifier of the license(s) for this package, e.g. BSD-2-Clause, GPL-3, LGPL-2.1. In order to assist machine readability, only include the license's SPDX short identifier (see the SPDX site). For multiple licenses multiple separate tags must be used. A package will have multiple licenses if different source files have different licenses. Every license occurring in the source files should have a corresponding tag. For any explanatory text about licensing caveats, please use the tag.

Commonly-used license strings:
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)
 * (Public Domain dedication)

Attributes

 * (optional): A path relative to the file containing the full license text. Many licenses require including the license text when redistributing the software. E.g. the Apache License, Version 2.0 states in paragraph 4.1: "You must give any other recipients of the Work or Derivative Works a copy of this License"

WYMAGANE

The tag describes the actual contents of the package. It has no attributes, and contains any number of children. Those children can have arbitrary tag names, only some of which may be recognized by FreeCAD. FreeCAD currently supports "workbench", "macro", and "preferencepack" elements. Each child is then defined recursively by this standard, containing any or all of the elements allowed for the root node. For example:

Unicorn Sparkles Theme 1.0.0    https://github.com/chennes/FreeCAD-themes/blob/main/Unicorn%20Sparkles%20Theme/Readme.md     sparkles.svg

The existence of items implies a set of subfolders, one for each content item, named exactly as the given name of the item. So for the example above, the package's folder structure is:

Package Directory/ package.xml Unicorn Sparkles Theme/ Unicorn Sparkles Theme.cfg sparkles.svg (the theme's other files)

In addition to the other elements of, content items can optionally provide information in , , and tags (technically these can be provided to the root tag as well, but they are generally unused there).

Backwards-compatibility note: to avoid having to restructure packages that pre-date this metadata standard, the optional  tag is allowed to specify "./" as the subdirectory for a content item, in which case no subdirectory is required. This matches the pre-standard system where a single workbench was located at the top of the directory structure.

REQUIRED for Workbenches

The path to an icon file. If it is an icon for the top-level package this path is relative to the package.xml file itself. If the icon is an element of a item, then the path is relative to the content's folder. The Addon Manager will display the top-level icon as the icon for the overall package. If no top-level icon is present, the first specified workbench icon will be used as the package icon.

Opcjonalnie.

Normally a content item is assumed to be located in a subdirectory with the same name as the item. In some cases, however, it is useful to explicitly specify the subdirectory. For example, many macros may be located within a single subdirectory, but each have their own entry in the package.xml file. It also provides backwards-compatibility support for packages that predate the package.xml file format specification, and do not follow the expected subdirectory structure. Often in these cases, a " ./ " is used to indicate that the item is not located in a subdirectory at all.

REQUIRED for Workbenches

For workbenches, the name of the Python main entry class. This is the class that FreeCAD will try to load on startup to locate the workbench's icon, which should be set as a member variable of the class. For example, if your workbench defines the following class (usually in InitGui.py):

then the package.xml file expects:

MyNewWB

Opcjonalnie

Provided for convenience to other tools, any number of other files may be listed here. Their use depends on the type of content. In a macro content item, each file entry is a single macro, and will be linked into the user's Macros installation directory by the Addon Manager.

Multiple allowed: "repository" is required, and "readme"-type is highly recommended.

A Uniform Resource Locator for the package's website, bug tracker, source repository, zip download link, readme file, or documentation (as specified by the "type" attribute, see below).

When specifying the "readme" type, a direct link to a rendered version of the README should be provided. For example, on GitHub, this is a "blob"-type link such as "https://github.com/FreeCAD/FreeCAD-addons/blob/master/README.md", or on a GitLab instance, "https://gitlab.com/opensimproject/cfdof/-/blob/master/README.md" (note the slightly different URL format between the two).

It is a good idea to include tags pointing users to your package's online resources. The website is commonly a wiki page on wiki.freecad.org where users can find and update information about the package, for example. The Addon Manager lists these URLs and provides clickable links to them in the package description.

Atrybuty

 * type="TYPE" (required): The type should be one of the following identifiers: "website", "bugtracker", "repository", "readme", "documentation", or "discussion".
 * branch="BRANCH" (required for type="repository"): The name of the branch to check out to obtain this package. Typically the name of your main development branch. May also specify any other type of git reference, e.g. a tag or specific commit.

Multiple allowed

The name of a person who is an author of the package, as acknowledgement of their work and for questions.

Attributes

 * email="name@domain.tld" (optional): Email address of author.

Multiple allowed

Declares a dependency on another FreeCAD Addon or internal workbench, or Python package. The named dependency is first checked against the list of known Addons (e.g. those available either from the official FreeCAD Addons git repository, or those in a custom user-specified repository). The check is against the canonical name of the Addon. If a package.xml file is present for that Addon, the name is that package's element. An exact match is required. If no match is found it is checked against the list of known internal workbenches (both installed and uninstalled). Finally, if the named dependency has not been located in the previous two steps it is assumed to be a Python package dependency. Note that not all dependency-related features are fully implemented yet.

Atrybuty
All dependencies and relationships may restrict their applicability to particular versions. For each comparison operator an attribute can be used. Two of these attributes can be used together to describe a version range.


 * version_lt="VERSION" (optional): The dependency to the package is restricted to versions less than the stated version number.
 * version_lte="VERSION" (optional): The dependency to the package is restricted to versions less or equal than the stated version number.
 * version_eq="VERSION" (optional): The dependency to the package is restricted to a version equal than the stated version number.
 * version_gte="VERSION" (optional): The dependency to the package is restricted to versions greater or equal than the stated version number.
 * version_gt="VERSION" (optional): The dependency to the package is restricted to versions greater than the stated version number.
 * condition="CONDITION_EXPRESSION": Every dependency can be conditional on a condition expression. If the condition expression evaluates to "true" the dependency is used and considered as if it doesn't have a condition attribute. If the condition expression evaluates to "false" the dependency is ignored and considered as if it doesn't exist. The expression must be a valid FreeCAD Expression (i.e. Python syntax), and may refer to the variables "$BuildVersionMajor", "$BuildVersionMinor", and "$BuildRevision" representing the version of FreeCAD currently running.
 * optional="true|false": If "optional" is "true", then the dependency is treated as optional when the Addon is installed using the Addon Manager. In general this means that a failure to install the dependency does not prevent the Addon from installing, and the user may be prompted about whether they want to install it. Versions of FreeCAD prior to 0.21 do not recognize this attribute and will ignore it.
 * type="automatic|addon|internal|python": Optional, defaults to "automatic". Indicates what this dependency statement refers to. "addon" is for external addons, "internal" is for internal workbenches (e.g. "arch", "sketcher", etc.), and "python" indicates a Python package dependency. Versions of FreeCAD prior to 0.21 do not use this attribute, and "automatic" is always assumed.

Multiple allowed

Declares a package name with which this package conflicts. This package and the conflicting package should not be installed at the same time.

Atrybuty
See.

Multiple allowed

Declares a package name that this package is intended to replace.

Atrybuty
See.

A simple text tag used for categorization when using a package manager. Multiple elements may be specified.

The minimum version of FreeCAD required to use this package/element, as a semantic version 2.0 string in the format MAJOR.MINOR.BUILD

The maximum version of FreeCAD required to use package/element, as a semantic version 2.0 string in the format MAJOR.MINOR.BUILD

(New in FreeCAD 0.21, ignored by previous versions.) The minimum version of Python required to use package/element, as a semantic version 2.0 string in the format MAJOR.MINOR. The Addon Manager will not permit an Addon to be installed on a system running a version of Python before this one. Only Python 3.x versions are supported. Although you may specify a three-component version, only the minor number is considered during the compatibility check.

Sprawdzanie poprawności
To validate your package.xml file you can enable "developer mode" in the Addon Manager: create a boolean variable called "developerMode" in the "Addons" parameter group and set it to True:. When the Addon Manager has finished reading the Addons database it will examine all available package.xml files for errors.

Quick guide
For a quick guide on how to create a basic package.xml file and add a workbench to the Addon Manager see: Add Workbench to Addon Manager.

Examples
Note that comments (the text between and ) are ignored by the XML parser, and are not a required part of the file format. They are provided here for information purposes and may be omitted from the final package.xml if desired.

A simple workbench-only package (for example, to add a metadata file to a package that predates this metadata format):

  Legacy Workbench Text that the Addon Manager shows for the Addon. Any length, but remember that Addon Manager's compact view only shows the first sentence or so. 1.0.1  2022-01-07   Your Name LGPL-2.1-or-later https://github.com/chennes/FreeCAD-Package https://github.com/chennes/FreeCAD-Package/blob/main/README.md  Resources/icons/PackageIcon.svg

MyLegacyWorkbench ./

A complex, multi-component package:

  Example Package Format An example of the package.xml file format 2022.01  2022-01-07   No Maintainer GPL-3.0-or-later https://github.com/chennes/FreeCAD-Package PackageIcon.svg

FreeCAD Classic Colors FreeCAD default colors for core app and included Mods. 1.0.0      color stylesheet Metadata Creation Workbench A set of tools to assist in creation of package.xml metadata files MetadataCreationWorkbench MCW Resources/mcw.svg developers 0.9.0-alpha Problem Solver 9000 Deletes all emails in your inbox ./      PS9000.FCMacro

A package with dependencies:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> <package format="1" xmlns="https://wiki.freecad.org/Package_Metadata"> Example with Dependencies An example of the package.xml file format 1.0.1-beta3 2022-01-07  <maintainer email="no-one@freecad.org">No Maintainer <license file="LICENSE">GPL-3.0-or-later <url type="repository" branch="main">https://github.com/chennes/FreeCAD-Package PackageIcon.svg

Metadata Creation Workbench A set of tools to assist in creation of package.xml metadata files MetadataCreationWorkbench MCW Resources/mcw.svg developers

FEM <depend version_gte="0.3.0">Curves workbench <depend version_gte="3.3" version_lt="4">Steel column

<depend optional="true" type="python">markdown TabBar

Metadata Creation Workbench Beta

<conflict condition="$BuildRevision==24267">Do not use with build 24267

matplotlib some_other_package