Skip to content

Commit

Permalink
(conan-io#16199) Update documentation URLs to use Conan v1 dedicated …
Browse files Browse the repository at this point in the history
…address

* update conan V1 docs url

Signed-off-by: Uilian Ries <[email protected]>

* revert non docs

Signed-off-by: Uilian Ries <[email protected]>

---------

Signed-off-by: Uilian Ries <[email protected]>
  • Loading branch information
uilianries authored Mar 23, 2023
1 parent 5a3cc36 commit 6e15116
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 139 deletions.
2 changes: 1 addition & 1 deletion docs/adding_packages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ In ConanCenter, our belief is recipes should always match upstream, in other wor

Where dependencies are involved, there's no shortcuts, inspect the upstream's build scripts for how they are usually consumed. Pick the Conan
generator that matches. The most common example is CMake's `find_package` that can be satisfied by Conan's
[`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) generator. There are a few
[`CMakeDeps`](https://docs.conan.io/1/reference/conanfile/tools/cmake/cmakedeps.html) generator. There are a few
things to be cautious about, many projects like to "vendor" other projects within them. This can be files checked into the repository or
downloaded during the build process. These should be removed, see the [Dependencies section](dependencies.md#handling-internal-dependencies)
for more information.
Expand Down
4 changes: 2 additions & 2 deletions docs/adding_packages/build_and_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ General patterns about how they can be used for OSS in ConanCenterIndex can be f
### Header Only

If you are looking for header-only projects, you can take a look on [header-only template](../package_templates/header_only).
Also, Conan Docs have a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html).
Also, Conan Docs have a section about [how to package header-only libraries](https://docs.conan.io/1/howtos/header_only.html).

### CMake

Expand All @@ -106,7 +106,7 @@ For cases where a project only offers source files, but not a build script, you

> **Note**: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the [FAQs](../faqs.md#can-i-install-packages-from-the-system-package-manager) for more.
The [SystemPackageTool](https://docs.conan.io/en/latest/reference/conanfile/methods.html#systempackagetool) can easily manage a system package manager (e.g. apt,
The [SystemPackageTool](https://docs.conan.io/1/reference/conanfile/methods.html#systempackagetool) can easily manage a system package manager (e.g. apt,
pacman, brew, choco) and install packages which are missing on Conan Center but available for most distributions. It is key to correctly fill in the `cpp_info` for the consumers of a system package to have access to whatever was installed.

As example there is [xorg](https://github.com/conan-io/conan-center-index/blob/master/recipes/xorg/all/conanfile.py). Also, it will require an exception rule for [conan-center hook](https://github.com/conan-io/hooks#conan-center), a [pull request](https://github.com/conan-io/hooks/pulls) should be open to allow it over the KB-H032.
6 changes: 3 additions & 3 deletions docs/adding_packages/conandata_yml_format.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# conandata.yml

[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/)
[conandata.yml](https://docs.conan.io/1/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/)
file to provide declarative data for the recipe (which is imperative). This is a built-in Conan feature (available since
1.22.0) without a fixed structure, but ConanCenter has a specific format to ensure quality of recipes.

Expand Down Expand Up @@ -114,7 +114,7 @@ sources:
sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e"
```

This approach requires a special code within [build](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build) method to handle.
This approach requires a special code within [build](https://docs.conan.io/1/reference/conanfile/methods.html#build) method to handle.

### Sources fields

Expand Down Expand Up @@ -240,4 +240,4 @@ For the `patch_type: conan`, it doesn't make sense to submit patch upstream, so

_Optional_

Specifies a sub-directory in project's sources to apply patch. This directory is relative to the [source_folder](https://docs.conan.io/en/latest/reference/conanfile/attributes.html?highlight=source_folder#source-folder). Usually, it would be a `source_subfolder`, but could be a lower-level sub-directory (e.g. if it's a patch for a submodule).
Specifies a sub-directory in project's sources to apply patch. This directory is relative to the [source_folder](https://docs.conan.io/1/reference/conanfile/attributes.html?highlight=source_folder#source-folder). Usually, it would be a `source_subfolder`, but could be a lower-level sub-directory (e.g. if it's a patch for a submodule).
18 changes: 9 additions & 9 deletions docs/adding_packages/conanfile_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ or are known by ConanCenter's build service and have special meaning.

## Attributes

These are a [key feature](https://docs.conan.io/en/latest/reference/conanfile/attributes.html) which allow the Conan client to understand,
These are a [key feature](https://docs.conan.io/1/reference/conanfile/attributes.html) which allow the Conan client to understand,
identify, and expose recipes and which project they expose.

In ConanCenter, there are a few conventions that need to be respected to ensure recipes can be discovered there `conan search` command
Expand Down Expand Up @@ -60,7 +60,7 @@ Where the SPDX guidelines do not apply, packages should do the following:

Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`):

For `conan create` the order is listed [here](https://docs.conan.io/en/latest/reference/commands/creator/create.html#methods-execution-order)
For `conan create` the order is listed [here](https://docs.conan.io/1/reference/commands/creator/create.html#methods-execution-order)
test packages recipes should append the following methods:

* deploy
Expand Down Expand Up @@ -168,25 +168,25 @@ Usage of each option should follow the rules:
### Options to Avoid

* `build_testing` should not be added, nor any other related unit test option. Options affect the package ID, therefore, testing should not be part of that.
Instead, use Conan config [skip_test](https://docs.conan.io/en/latest/reference/config_files/global_conf.html#tools-configurations) feature:
Instead, use Conan config [skip_test](https://docs.conan.io/1/reference/config_files/global_conf.html#tools-configurations) feature:

```python
def generate(self):
tc = CMakeToolChain(self)
tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=true, check_type=bool)
```

The `skip_test` configuration is supported by [CMake](https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#test) and [Meson](https://docs.conan.io/en/latest/reference/build_helpers/meson.html#test).
The `skip_test` configuration is supported by [CMake](https://docs.conan.io/1/reference/build_helpers/cmake.html#test) and [Meson](https://docs.conan.io/1/reference/build_helpers/meson.html#test).

### Removing from `package_id`
By default, options are included in the calculation for the `package_id` ([docs](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-id)).

By default, options are included in the calculation for the `package_id` ([docs](https://docs.conan.io/1/reference/conanfile/methods.html#package-id)).
Options which do not impact the generated packages should be deleted, for instance adding a `#define` for a package.

```python
def package_id(self):
del self.info.options.enable_feature

def package_info(self):
if self.options.enable_feature:
self.cpp_info.defines.append("FOBAR_FEATURE=1")
Expand Down
36 changes: 18 additions & 18 deletions docs/adding_packages/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ from handling "vendored" dependencies to what versions should be used.

## List Dependencies

Since all ConanCenterIndex recipes are to build and/or package projects they are exclusively done in [`conanfile.py`](https://docs.conan.io/en/latest/reference/conanfile.html). This offers a few
ways to add requirements. The most common way is [requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements):
Since all ConanCenterIndex recipes are to build and/or package projects they are exclusively done in [`conanfile.py`](https://docs.conan.io/1/reference/conanfile.html). This offers a few
ways to add requirements. The most common way is [requirements](https://docs.conan.io/1/reference/conanfile/methods.html#requirements):

```py
def requirements(self):
Expand Down Expand Up @@ -53,14 +53,14 @@ class ExampleConan(ConanFile):
self.requires("zlib/1.2.13")
```

If a dependency was added (or removed) with a release, then the `if` condition could check [`self.version`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#version). Another common case is
If a dependency was added (or removed) with a release, then the `if` condition could check [`self.version`](https://docs.conan.io/1/reference/conanfile/attributes.html#version). Another common case is
`self.settings.os` dependant requirements which need to be added for certain plaforms.

### Build Requirements

In ConanCenter we only assume
[CMake is available](../faqs.md#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default).
If a project requires any other specific tool, those can be added as well. We like to do this with [build_requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build-requirements):
If a project requires any other specific tool, those can be added as well. We like to do this with [build_requirements](https://docs.conan.io/1/reference/conanfile/methods.html#build-requirements):

```py
def build_requirements(self):
Expand All @@ -69,13 +69,13 @@ If a project requires any other specific tool, those can be added as well. We li

## Accessing Dependencies

It's fairly common to need to pass information from a dependency to the project. This is the job of the [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) method. This
is generally covered by the built-in generators like [`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html)
However the [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=generate) are available.
It's fairly common to need to pass information from a dependency to the project. This is the job of the [`generate()`](https://docs.conan.io/1/reference/conanfile/methods.html#generate) method. This
is generally covered by the built-in generators like [`CMakeDeps`](https://docs.conan.io/1/reference/conanfile/tools/cmake/cmakedeps.html)
However the [`self.dependencies`](https://docs.conan.io/1/reference/conanfile/dependencies.html?highlight=generate) are available.

Alternatively, a project may depend on a specific versions or configuration of a dependency. This use case is again covered by the
[`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=validate) within the
[`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method. Additionally it's possible to suggest the option's values while the graph is built through [`configure()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options)
[`self.dependencies`](https://docs.conan.io/1/reference/conanfile/dependencies.html?highlight=validate) within the
[`validate()`](https://docs.conan.io/1/reference/conanfile/methods.html#validate) method. Additionally it's possible to suggest the option's values while the graph is built through [`configure()`](https://docs.conan.io/1/reference/conanfile/methods.html#configure-config-options)
this is not guaranteed and not a common practice.

### Handling Requirement's Options
Expand All @@ -84,10 +84,10 @@ Forcing options of dependencies inside a ConanCenter should be avoided, except i
Our general belief is the users input should be the most important; it's unexpected for command line arguments to be over ruled
by specifc recipes.

You need to use the [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method in order to ensure they check after the Conan graph is completely built.
You need to use the [`validate()`](https://docs.conan.io/1/reference/conanfile/methods.html#validate) method in order to ensure they check after the Conan graph is completely built.

Certain projects are dependent on the configuration (also known as options) of a dependency. This can be enforced in a recipe by
accessing the [`options`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=options) field of
accessing the [`options`](https://docs.conan.io/1/reference/conanfile/dependencies.html?highlight=options) field of
the dependency.

```py
Expand All @@ -111,10 +111,10 @@ def validate(self):

### Passing Requirement's info to `build()`

The [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html) are limited to [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) and [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate). This means configuring a projects build scripts
The [`self.dependencies`](https://docs.conan.io/1/reference/conanfile/dependencies.html) are limited to [`generate()`](https://docs.conan.io/1/reference/conanfile/methods.html#generate) and [`validate()`](https://docs.conan.io/1/reference/conanfile/methods.html#validate). This means configuring a projects build scripts
is a touch more complicated when working with unsupported build scripts.

In general, with [CMake](https://cmake.org/) project, this can be very simple with the [`CMakeToolchain`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html), such as:
In general, with [CMake](https://cmake.org/) project, this can be very simple with the [`CMakeToolchain`](https://docs.conan.io/1/reference/conanfile/tools/cmake/cmaketoolchain.html), such as:

```py
def generate(self):
Expand All @@ -127,7 +127,7 @@ In general, with [CMake](https://cmake.org/) project, this can be very simple wi
This pattern can be recreated for less common build system by, generating a script to call configure or capture the
required values in a YAML files for example.

> **Note**: This needs to be saved to disk because the [`conan install`](https://docs.conan.io/en/latest/reference/commands/consumer/install.html) and [`conan build`](https://docs.conan.io/en/latest/reference/commands/development/build.html) commands can be separated when
> **Note**: This needs to be saved to disk because the [`conan install`](https://docs.conan.io/1/reference/commands/consumer/install.html) and [`conan build`](https://docs.conan.io/1/reference/commands/development/build.html) commands can be separated when
> developing packages so for this reason the `class` may not persists the information. This is a very common workflow,
> even used in ConanCenter in other areas such as testing.
Expand Down Expand Up @@ -168,14 +168,14 @@ for consumer, we do impose some limits on Conan features to provide a smoother f

> **Note**: These are very specific to the ConanCenter being the default remote and may not be relevant to your specifc use case.
* [Version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) are not allowed.
* Specify explicit [RREV](https://docs.conan.io/en/latest/versioning/revisions.html) (recipe revision) of dependencies is not allowed.
* [Version ranges](https://docs.conan.io/1/versioning/version_ranges.html) are not allowed.
* Specify explicit [RREV](https://docs.conan.io/1/versioning/revisions.html) (recipe revision) of dependencies is not allowed.
* Only ConanCenter recipes are allowed in `requires`/`requirements()` and `build_requires`/`build_requirements()`.
* [`python_requires`](https://docs.conan.io/en/latest/reference/conanfile/other.html#python-requires) are not allowed.
* [`python_requires`](https://docs.conan.io/1/reference/conanfile/other.html#python-requires) are not allowed.

### Version Ranges

Version ranges are a useful Conan feature, [documentation here](https://docs.conan.io/en/latest/versioning/version_ranges.html). However,
Version ranges are a useful Conan feature, [documentation here](https://docs.conan.io/1/versioning/version_ranges.html). However,
in the context of ConanCenter they pose a few key challenges when being used generally to consume packages, most notably:

* Non-Deterministic `package-id`: With version ranges the newest compatible package may yield a different `package_id` than the one built
Expand Down
4 changes: 2 additions & 2 deletions docs/adding_packages/folders_and_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ When a package needs other packages those can be include with the `requirements(

For more information see the [Dependencies](dependencies.md) documentation.

For compiled libraries, the `build()` method is used along side the [build helpers](https://docs.conan.io/en/latest/reference/build_helpers.html).
For compiled libraries, the `build()` method is used along side the [build helpers](https://docs.conan.io/1/reference/build_helpers.html).
This allows you to use the official build script from a project, see [build and package](build_and_package.md) instructions.

```python
Expand Down Expand Up @@ -176,7 +176,7 @@ Here's an example for a header only library:

All the packages in this repository need to be tested before they join ConanCenter. A `test_package` folder with its
corresponding `conanfile.py` and a minimal project to test the package is strictly required. You can read about it in the
[Conan documentation](https://docs.conan.io/en/latest/creating_packages/getting_started.html) and learn about ConanCenterIndex
[Conan documentation](https://docs.conan.io/1/creating_packages/getting_started.html) and learn about ConanCenterIndex
specific conventions in [test package](test_packages.md) section.

The goal for the test package is to make sure the
Expand Down
8 changes: 4 additions & 4 deletions docs/adding_packages/sources_and_patches.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ It's ideal to minimize the number of files in a package to exactly what's requir
versions with differing patches, it's strongly encouraged to only export the patches used for that given recipe.

Make sure the `export_sources` attribute is replaced by
[`conan.tools.files.export_conandata_patches`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html?highlight=export_conandata_patches)
[`conan.tools.files.export_conandata_patches`](https://docs.conan.io/1/reference/conanfile/tools/files/patches.html?highlight=export_conandata_patches)
helper.

```py
Expand All @@ -118,7 +118,7 @@ def export_sources(self):
### Applying Patches

Patches can be applied in a separate method, the pattern name is `_patch_sources`. When applying patch files,
using [`conan.tools.files.apply_conandata_patches`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html?highlight=apply_conandata_patches)
using [`conan.tools.files.apply_conandata_patches`](https://docs.conan.io/1/reference/conanfile/tools/files/patches.html?highlight=apply_conandata_patches)
is the best option.

```py
Expand All @@ -127,8 +127,8 @@ def build(self):
```

For more complicated cases,
[`conan.tools.files.rm`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-rm)
or [`conan.tools.files.replace_in_file`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-replace-in-file)
[`conan.tools.files.rm`](https://docs.conan.io/1/reference/conanfile/tools/files/basic.html#conan-tools-files-rm)
or [`conan.tools.files.replace_in_file`](https://docs.conan.io/1/reference/conanfile/tools/files/basic.html#conan-tools-files-replace-in-file)
are good choices.

```py
Expand Down
Loading

0 comments on commit 6e15116

Please sign in to comment.