depmanager


Namedepmanager JSON
Version 0.3.3 PyPI version JSON
download
home_page
SummarySimple Dependency manager
upload_time2024-01-27 12:48:48
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Silmaen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords dependency development cmake c++
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DepManager

[![PyPI](https://img.shields.io/pypi/v/depmanager)](https://pypi.org/project/depmanager)
[![Download](https://static.pepy.tech/badge/depmanager)](https://pepy.tech/project/depmanager)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Depmanager is a minimalistic tool to manage dependencies (also known as third-party
libraries) of a C++ Project. It works closely with cmake tool.

It allow to store dependencies in a distant repository to share builds with other and
have a local cache project-independent.

## Installation

Depmanager is written in python so in the following we assume you have a
working python installation designated as `<python>` with `pip` installed.

### pip

To install dep manager simply use `<python> -m pip  install depmanager`

See the page on Pypi: [depmanager](https://pypi.org/project/depmanager/).

### From source

Prerequisite: python module 'build' install it with `<python> -m pip install build`

Clone the gitHub repository.

In the source root do:

```powershell
<python> -m build
<python> -m pip install dist/depmanager-x.y.z-py3-none-any.whl
```

## Commandline use

### Get help

For any command or sub-command adding `--help` or `-h` to get help
on parameters or usage.

### Generalities

In the base commande you can find:

| command | subcommands                 | description                        |
|---------|-----------------------------|------------------------------------|
| info    | basedir, cmakedir, version  | info on local instance             |
| get     |                             | Get the config package             |
| pack    | pull, push, add, del, query | Manage packages                    |
| remote  | list, add, del, info        | Manage the list of distant servers |
| build   |                             | Build a new package                |

In the following, `<query>` designate something representing the dependency's description.
The syntax reads:  `--predicate(-p) <name>:<version> --type(-t)
<type> --os(-o) <os> --arch(-a) <arch> --compiler(-c) <compiler> --glibc <glibc>`

Valid values for `type`: `shared`, `static`, `header`.

Valid values for `os` : `Windows`, `Linux` (default: host os)

Valid values for `arch` : `x86_64`, `aarch64` (default: host arch)

Valid values for `compiler` : `gnu`, `msvc` (default: `gnu`)
Note: clang compiler stands for `gnu` while clang-cl stands for `msvc`.

Valid values for `glibc` are only needed for linux. By giving, a value the system will look at
package with compatible version will be search (ie. wit a version number lower or equal).
It is still possible to do an exact search by using `=` as first character. (like `--glibc =2.36`)

Also, we will designate `<remote>` as a description a remote server, syntax reads: `[-n <name>|-d]`.
If nothing given, we assume 'local'. If `-d` given, use the default remote, else use the remote by
its name.

If the name does not exist, it will fall back to default then to local.

## Base commands

### info

Subcommands:

* `version` gives the version of the local manager.
* `basedir` gives the path to the local data of the manager
* `cmakedir` gives the path to add to `CMAKE_MODULE_PATH` before include `ExternalDependencyManager`

### get

`depmanager get <query>`

Get path to cmake config of the 'best' package given by the query information.

The command will first search in the local cache, if not found it will search in the default remote. This does not
intent for human use but more for
cmake integration.

### pack

Actions on packages.

#### query

`depmanager pack query <query> [--transitive(-t)] <remote>` Simply do a search in the given remote (in local if
nothing given) and print the result.

The `--transitive(-t)` flag will allow to use transitive query, meaning to search for local then remote.

#### add, del

`depmanager pack add <location>` Will add a package to the local database. `<location>` can be a
folder, then it must contain a properly formatted `edp.info` file. Or an archive (.zip, .tgz or .tar.gz
file format allowed). The uncompressed archive must contain a properly formatted `edp.info` file.

`depmanager pack del <query> <remote> [-r]` Will remove from local cache all package matching the query.

The `-r` option allows operation on multiple packages (local only), else the command will return an error if multiple
package matches the query.

#### push, pull

`depmanager pack [push|pull] <query> <remote> [--force(-f)] [-r]` will synchronize Local cache with the remote.
The `query` must be precise enough to match one and only one package. `remote` must be valid.

`push` will look for the package in local cache that match the query and send it to the given remote.

`pull` will look for the package in given remote that match the query and bring it to the local cache.

If `--force` is given, The transfert occurs even if the package already exists in the destination.

The `-r` option allows operation on multiple packages. If multiple versions, only the highest one will be used.

#### clean

`depmanager pack clean [--full(-f)]` Will clean the local repository by removing old packages, only the newest
version of each package is kept.

The `[--full(-f)]` option will make the clean operation applies to all package, thus emptying the local database.

### remote

Manage the list of remote servers
subcommands:

* `list` lists the defined remote server.
* `add` adds a new remote to the list.
    * `--name(-n) <name> --url(-u) <proto>://<url[:port]> [--default(-d)]`.
    * Mandatory. If name already exists it will modify the existing one.
    * Allowed proto are:
        * `ftp` supports login
        * `folder` a folder of your computer (mostly for debug or testing)
        * `srv` a dedicated server see [gitHub](https://github.com/Silmaen/DepManagerServer)
        * `srvs` a dedicated server with secure connexion see [gitHub](https://github.com/Silmaen/DepManagerServer)
    * Login can be defined with: `--login(-l) <login> --passwd(-p) <passwd>`.
* `del <remote>` remove the designated remote if exists.
* `sync <remote> [--push-only|--pull-only] [--dry-run]` push to remote all local package that does not already
  exist on remote. Pull local package that have a newer version on the remote. If no remote given, it will use the
  default one.
* `info <remote>` gets information from the remote: type and version.

### build

`depmanager build [OPTIONS] <location>` will search for recipe in the given location and build them.

Some option can be passed to the build system:

* `--single-thread`: on some low-end devices (such as RaspberryPi) single thread build is recommended.
* `--force`, `-f`: Force the build even if the dependency already exists
* `--cross-c`: redefine the C compiler
* `--cross-cxx`: redefine the C++ compiler
* `--cross-arch`: redefine the architecture
* `--cross-os`: redefine the OS

## Using package with cmake

### Include depmanager to cmake

To initialize depmanager into cmake you need to add to `CMAKE_MODULE_PATH` the path
to the cmake folder of this installation.

Here is a small cmake code snippet to initialize depmanager in cmake.

```cmake
# add HINTS or PATH to find the executable if not in the PATH
find_program(EDEPMANAGER depmanager) 
if (${EDEPMANAGER} STREQUAL EDEPMANAGER-NOTFOUND)
    message(FATAL_ERROR "Dependency manager not found.")
else()
    execute_process(COMMAND ${EDEPMANAGER} info cmakedir
            OUTPUT_VARIABLE depmanager_path)
    string(STRIP ${depmanager_path} depmanager_path)
    list(PREPEND CMAKE_MODULE_PATH ${depmanager_path})
    include(DepManager)
endif()
```

### Automated mode

In automated mode, depmanager can automatically set a remote repository, retrieve packages from this repository
and load then in one command.

#### The command

```cmake
dm_load_environment(
   [QUIET]
   [PATH path]
   [KIND kind]
   [ARCH target_arch]
   [OS target_os]
   [COMPILER target_compiler]
   [GLIBC target_glibc]
) 
```

If `QUIET` set, only errors are written.

`path` is the path to the configuration file, either directly a configuration file name,
or a directory containing a file named `depmanager.yml`. By default, it will look at the
project root. See the next paragraph for more information about configuration file.

`kind` is used to force library kind (`shared`, `static`, `header`). By default, it uses
the value from `BUILD_SHARED_LIBS`.

`target_arch`, `target_os`, `target_compiler`, `target_glibc` are used in the query. If not set, default
values are `CMAKE_SYSTEM_PROCESSOR`, `CMAKE_SYSTEM_NAME` and `CMAKE_CXX_COMPILER_ID`

The cmake function will update the CMAKE variable for the search of package.

After call this command, the cmake user has to call for needed `find_package`.

#### Configuration file

The configuration file is a yaml file. Here is an example with explication in comment.

```yaml
remote:
  # If server is defined, depmanager will add this server to its
  # database (if not already there)
  server:
    # Same parameter as command-line (also the required)
    name: "my_server"
    kind: "srvs"
    url: "https://packages.example.net"
    login: "foo"
    passwd: "bar"
  # If package not found locally, do you allow for download?
  pull: true
  # If newer remote package exists, download it? (implies 'pull')
  pull-newer: true
packages:
  # list the needed packages.
  fmt:
    # version 'at least'
    version: ">=10.1.0"
  spdlog:
    # exact version
    version: "1.12.0"
  debugbreak:
    # if not found locally, don't pull, nor error.
    optional: true
  glm:
    version: "0.9.9.9"
    # force the shared version even in static build mode.
    kind: "shared"
  glfw:
    # use this only for the (same for arch, and compiler)
    os: Linux
```

### Manual mode

In manual mode you should load or find each package individually.
You should also manually set the remote and download the package.

#### Find packages

With depmanager initialized in cmake, it provides an alternative to classical `find_package`
of cmake by `dm_find_package`

```cmake
dm_find_package(
   package
   [QUIET] [TRACE] [REQUIRED]
   [VERSION version]
   [KIND kind]
   [ARCH target_arch]
   [OS target_os]
   [COMPILER target_compiler]
   [GLIBC target_glibc]
)
```

`package` is the package name to find.

`version` is the exact version to match (wildcard are allowed). By default, find the
latest one.

`kind` is used to force library kind (`shared`, `static`, `header`). By default, it returns
the first found.

If `REQUIRED` set, the function will give an error if no package found.
(same as original `find_package`)

If `QUIET` set, only errors are written. (same as original `find_package`). In opposition,
if `TRACE` set, many more debug message displayed.

`target_arch`, `target_os`, `target_compiler` `target_glibc` are used in the query. If not set, default
values are `CMAKE_SYSTEM_PROCESSOR`, `CMAKE_SYSTEM_NAME` and `CMAKE_CXX_COMPILER_ID`

**LIMITATION:** it requires the library name is the package name. So no multi lib or lib with different name.

#### Load package

This command is similar to the previous one, but does not directly do a cmake's `find_package`.
It only adds to the `CMAKE_PREFIX_PATH` list the folders of given package.

```cmake
dm_load_package(
   package
   [REQUIRED] [TRACE]
   [VERSION version]
   [KIND kind]
   [ARCH target_arch]
   [OS target_os]
   [COMPILER target_compiler]
   [GLIBC target_glibc]
)
```

After call this command, the cmake user has to call for needed `find_package`.

## Create you own package

Depmanager allow you to create your own packages by defining recipes. Then run
`depmanager build <location of recipes> [OPTIONS]`
The program will then build and add dependencies to the local cache.

The location can contain as many recipe in any number of files.

The search behavior can bve set as recursive with option `--recursive,-r`. As sometimes, sources also contains python
files that may fail to load, the depth of recursion can be restrained using `--recursi-depth <n>`.

By default, a package will not be build if already exists in the local cache. You can force the rebuild with the
option `--force,-f`.

By default, the builder will use all the cpu cores, but `--single-thred,-s` will force to use only one core.

Cross-compilation can be used by giving the tools at command
line: `--cross-c <C_COMPILER> --cross-cxx <CXX_COMPILER> --cross-arch <TARGET_ARCH> --cross-os <TARGET_OS>`

It is also possible to give a remote name `-n <remote_name>` or set to default remote `-d`. This way,
The builder will look into remote to see if an package already exists and pull it instead of building it.
Also, after a successful build, it will automatically push to the remote. Use either `--no-pull`and `--no-push`
option to skip these steps.

A `--dry-run` option will do all the checks and print the results but no pull, build and push action will be done.

### The recipe

During build, Depmanager will look in all `.py` file for class that inherits from
depmanager.api.recipe.Recipe.

As for dependency usage, build also rely on cmake for building.

The builder will use the provided recipe in the following workflow:

* Init recipe
* Call `recipe.source()`
* Call `recipe.configure()`
* Initialize options based on recipe data
* Run cmake configure
* For all configuration (mostly 'Debug', 'Release')
    * build target `install`
* Call `recipe.install()`
* Generate edp.info file
* Import into local cache
* Call `recipe.clean()`
* Clean Temporary

Here is a small example

```python
"""
Small recipe example
"""
from depmanager.api.recipe import Recipe


class MyAwesomeLib(Recipe):
    """
    Awesome lib
    """
    name = "awesome_lib"  # lib name
    version = "0.0.1.foo"  # lib version
    source_dir = "src"  # where to fine the sources (especially) the CmakeList.txt
    kind = "static"  # the lib's kind


class AnotherAwesomeLib(MyAwesomeLib):
    """
    Shared version of previous one
    """
    kind = "shared"
```

As many python file may exist in the source you want to build, python file using shebang will be ignored to avoid errors
when parsing them. Do not add shebang in your recipe files.

## Roadmap

First of all in the roadmap is to use this tool in C++ project to get feedback.

Among things:

* version 0.7.x
    * [ ] Creation of a frontend application.
        * [ ] Can view, edit, suppress local package.
        * [ ] Can add, remove, explore remotes.
        * [ ] Can push, pull packages.
* version 0.6.x
    * [ ] Add recipe libray
        * [ ] Possibility to store the recipes in remote
        * [ ] Auto build recipe if neither local nor remote found.
* version 0.5.x
    * [ ] Add a sorting order for remotes.
        * [ ] Searching across remotes with final package sorting.
        * [ ] Allow auto-pull best-fitting package
* version 0.4.x
    * [ ] Add concept of toolset.
        * [ ] Tool set defines arch, os and compilers; stored in config.ini; with a default one.
        * [ ] Use toolset in build.
        * [ ] Use toolset in queries.
    * [ ] More detail documentation.
        * [ ] Documentation hosted in instance of [Depmanager Server](https://github.com/Silmaen/DepManagerServer).
* version 0.3.3 -- 2024-01-27
    * [X] Improved Builder Configurations management
    * [X] Operation on multiple package
        * [X] add a 'clean' command
            * [X] basic mode: keep only the newest packages
            * [X] full mode: delete everything.
        * [X] allow local deletion of multiple packages
        * [X] allow push/pull of multiple packages
* version 0.3.2 -- 2024-01-19
    * [X] Better management of push in auto-build
    * [X] Bugfixes in the use of CMake
    * [X] manage dependency in the list of Recipes
* version 0.3.1 -- 2024-01-16
    * [X] Allow to externally control the build system
        * [X] Allow to build a package by giving a single recipe
        * [X] Allow to pull packages prior to build if exists on a remote
        * [X] Allow to push (force) to remote after build
    * [X] Helper functions to find recipes in filesystem
        * [X] Allow recursive search
* version 0.3.0 -- 2024-01-12
    * [X] CMake integration improvement
        * [X] Simplify integration with cmake
        * [X] Python auto generate the Module dir for cmake
        * [X] Allow to load package by batch
            * [X] use Yaml config file.
* version 0.2.1 -- 2023-12-31
    * [X] Bufix: allow more date format and don't break if bad format.
* version 0.2.0 -- 2023-12-12
    * WARNING: Some breaking change. Backward compatibility not fully tested.
    * [X] Faster commandline
        * [X] Use remote connexion only if needed
    * [X] Transitive search
        * [X] Query: search in local then remote.
        * [X] get: Auto-pull if not in local.
    * [X] Add new remote command.
        * [X] Get info from remote (type and version)
        * [X] Allow to delete package on remote.
    * [X] Better Package properties
        * [X] Add build Date in package properties.
        * [X] Add build glibc version in package properties if applicable.
        * [X] Better queries on glibc compatible system
        * [X] Use system's glibc in get searches
* version 0.1.4 -- 2023-06-21
    * [X] Allow to sync with remote.
        * [X] Allow to pull local package that have newer version.
        * [X] Allow to push local package newer than remote or not existing in remote.
    * [X] Allow to force push/pull.
    * [X] Bugfix: safe delete
* version 0.1.3 -- 2023-06-12
    * [X] Update internal statuses when using API.
    * [X] omit -d in push/pull command.
    * [X] add progress bar in push/pull command.
    * [X] Allow single thread in build.
* version 0.1.2 -- 2023-05-31
    * [X] Add possibility to force os, arch and compiler for cross compiling.
    * [X] Adapt build system to search dependency in the forced environment.
* version 0.1.1
    * [X] Add remote 'srv' Type: a dedicated dependency server.
    * [X] Add remote 'srvs' Type: a dedicated dependency server with secure connexion.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "depmanager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "dependency,development,cmake,C++",
    "author": "",
    "author_email": "Silmaen <genteur.slayer@laposte.net>",
    "download_url": "https://files.pythonhosted.org/packages/6d/9b/d7ecb5729fa40305ee9ead35b8f1d7b74c5595dfe66fae095895e787630f/depmanager-0.3.3.tar.gz",
    "platform": null,
    "description": "# DepManager\r\n\r\n[![PyPI](https://img.shields.io/pypi/v/depmanager)](https://pypi.org/project/depmanager)\r\n[![Download](https://static.pepy.tech/badge/depmanager)](https://pepy.tech/project/depmanager)\r\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n\r\nDepmanager is a minimalistic tool to manage dependencies (also known as third-party\r\nlibraries) of a C++ Project. It works closely with cmake tool.\r\n\r\nIt allow to store dependencies in a distant repository to share builds with other and\r\nhave a local cache project-independent.\r\n\r\n## Installation\r\n\r\nDepmanager is written in python so in the following we assume you have a\r\nworking python installation designated as `<python>` with `pip` installed.\r\n\r\n### pip\r\n\r\nTo install dep manager simply use `<python> -m pip  install depmanager`\r\n\r\nSee the page on Pypi: [depmanager](https://pypi.org/project/depmanager/).\r\n\r\n### From source\r\n\r\nPrerequisite: python module 'build' install it with `<python> -m pip install build`\r\n\r\nClone the gitHub repository.\r\n\r\nIn the source root do:\r\n\r\n```powershell\r\n<python> -m build\r\n<python> -m pip install dist/depmanager-x.y.z-py3-none-any.whl\r\n```\r\n\r\n## Commandline use\r\n\r\n### Get help\r\n\r\nFor any command or sub-command adding `--help` or `-h` to get help\r\non parameters or usage.\r\n\r\n### Generalities\r\n\r\nIn the base commande you can find:\r\n\r\n| command | subcommands                 | description                        |\r\n|---------|-----------------------------|------------------------------------|\r\n| info    | basedir, cmakedir, version  | info on local instance             |\r\n| get     |                             | Get the config package             |\r\n| pack    | pull, push, add, del, query | Manage packages                    |\r\n| remote  | list, add, del, info        | Manage the list of distant servers |\r\n| build   |                             | Build a new package                |\r\n\r\nIn the following, `<query>` designate something representing the dependency's description.\r\nThe syntax reads:  `--predicate(-p) <name>:<version> --type(-t)\r\n<type> --os(-o) <os> --arch(-a) <arch> --compiler(-c) <compiler> --glibc <glibc>`\r\n\r\nValid values for `type`: `shared`, `static`, `header`.\r\n\r\nValid values for `os` : `Windows`, `Linux` (default: host os)\r\n\r\nValid values for `arch` : `x86_64`, `aarch64` (default: host arch)\r\n\r\nValid values for `compiler` : `gnu`, `msvc` (default: `gnu`)\r\nNote: clang compiler stands for `gnu` while clang-cl stands for `msvc`.\r\n\r\nValid values for `glibc` are only needed for linux. By giving, a value the system will look at\r\npackage with compatible version will be search (ie. wit a version number lower or equal).\r\nIt is still possible to do an exact search by using `=` as first character. (like `--glibc =2.36`)\r\n\r\nAlso, we will designate `<remote>` as a description a remote server, syntax reads: `[-n <name>|-d]`.\r\nIf nothing given, we assume 'local'. If `-d` given, use the default remote, else use the remote by\r\nits name.\r\n\r\nIf the name does not exist, it will fall back to default then to local.\r\n\r\n## Base commands\r\n\r\n### info\r\n\r\nSubcommands:\r\n\r\n* `version` gives the version of the local manager.\r\n* `basedir` gives the path to the local data of the manager\r\n* `cmakedir` gives the path to add to `CMAKE_MODULE_PATH` before include `ExternalDependencyManager`\r\n\r\n### get\r\n\r\n`depmanager get <query>`\r\n\r\nGet path to cmake config of the 'best' package given by the query information.\r\n\r\nThe command will first search in the local cache, if not found it will search in the default remote. This does not\r\nintent for human use but more for\r\ncmake integration.\r\n\r\n### pack\r\n\r\nActions on packages.\r\n\r\n#### query\r\n\r\n`depmanager pack query <query> [--transitive(-t)] <remote>` Simply do a search in the given remote (in local if\r\nnothing given) and print the result.\r\n\r\nThe `--transitive(-t)` flag will allow to use transitive query, meaning to search for local then remote.\r\n\r\n#### add, del\r\n\r\n`depmanager pack add <location>` Will add a package to the local database. `<location>` can be a\r\nfolder, then it must contain a properly formatted `edp.info` file. Or an archive (.zip, .tgz or .tar.gz\r\nfile format allowed). The uncompressed archive must contain a properly formatted `edp.info` file.\r\n\r\n`depmanager pack del <query> <remote> [-r]` Will remove from local cache all package matching the query.\r\n\r\nThe `-r` option allows operation on multiple packages (local only), else the command will return an error if multiple\r\npackage matches the query.\r\n\r\n#### push, pull\r\n\r\n`depmanager pack [push|pull] <query> <remote> [--force(-f)] [-r]` will synchronize Local cache with the remote.\r\nThe `query` must be precise enough to match one and only one package. `remote` must be valid.\r\n\r\n`push` will look for the package in local cache that match the query and send it to the given remote.\r\n\r\n`pull` will look for the package in given remote that match the query and bring it to the local cache.\r\n\r\nIf `--force` is given, The transfert occurs even if the package already exists in the destination.\r\n\r\nThe `-r` option allows operation on multiple packages. If multiple versions, only the highest one will be used.\r\n\r\n#### clean\r\n\r\n`depmanager pack clean [--full(-f)]` Will clean the local repository by removing old packages, only the newest\r\nversion of each package is kept.\r\n\r\nThe `[--full(-f)]` option will make the clean operation applies to all package, thus emptying the local database.\r\n\r\n### remote\r\n\r\nManage the list of remote servers\r\nsubcommands:\r\n\r\n* `list` lists the defined remote server.\r\n* `add` adds a new remote to the list.\r\n    * `--name(-n) <name> --url(-u) <proto>://<url[:port]> [--default(-d)]`.\r\n    * Mandatory. If name already exists it will modify the existing one.\r\n    * Allowed proto are:\r\n        * `ftp` supports login\r\n        * `folder` a folder of your computer (mostly for debug or testing)\r\n        * `srv` a dedicated server see [gitHub](https://github.com/Silmaen/DepManagerServer)\r\n        * `srvs` a dedicated server with secure connexion see [gitHub](https://github.com/Silmaen/DepManagerServer)\r\n    * Login can be defined with: `--login(-l) <login> --passwd(-p) <passwd>`.\r\n* `del <remote>` remove the designated remote if exists.\r\n* `sync <remote> [--push-only|--pull-only] [--dry-run]` push to remote all local package that does not already\r\n  exist on remote. Pull local package that have a newer version on the remote. If no remote given, it will use the\r\n  default one.\r\n* `info <remote>` gets information from the remote: type and version.\r\n\r\n### build\r\n\r\n`depmanager build [OPTIONS] <location>` will search for recipe in the given location and build them.\r\n\r\nSome option can be passed to the build system:\r\n\r\n* `--single-thread`: on some low-end devices (such as RaspberryPi) single thread build is recommended.\r\n* `--force`, `-f`: Force the build even if the dependency already exists\r\n* `--cross-c`: redefine the C compiler\r\n* `--cross-cxx`: redefine the C++ compiler\r\n* `--cross-arch`: redefine the architecture\r\n* `--cross-os`: redefine the OS\r\n\r\n## Using package with cmake\r\n\r\n### Include depmanager to cmake\r\n\r\nTo initialize depmanager into cmake you need to add to `CMAKE_MODULE_PATH` the path\r\nto the cmake folder of this installation.\r\n\r\nHere is a small cmake code snippet to initialize depmanager in cmake.\r\n\r\n```cmake\r\n# add HINTS or PATH to find the executable if not in the PATH\r\nfind_program(EDEPMANAGER depmanager) \r\nif (${EDEPMANAGER} STREQUAL EDEPMANAGER-NOTFOUND)\r\n    message(FATAL_ERROR \"Dependency manager not found.\")\r\nelse()\r\n    execute_process(COMMAND ${EDEPMANAGER} info cmakedir\r\n            OUTPUT_VARIABLE depmanager_path)\r\n    string(STRIP ${depmanager_path} depmanager_path)\r\n    list(PREPEND CMAKE_MODULE_PATH ${depmanager_path})\r\n    include(DepManager)\r\nendif()\r\n```\r\n\r\n### Automated mode\r\n\r\nIn automated mode, depmanager can automatically set a remote repository, retrieve packages from this repository\r\nand load then in one command.\r\n\r\n#### The command\r\n\r\n```cmake\r\ndm_load_environment(\r\n   [QUIET]\r\n   [PATH path]\r\n   [KIND kind]\r\n   [ARCH target_arch]\r\n   [OS target_os]\r\n   [COMPILER target_compiler]\r\n   [GLIBC target_glibc]\r\n) \r\n```\r\n\r\nIf `QUIET` set, only errors are written.\r\n\r\n`path` is the path to the configuration file, either directly a configuration file name,\r\nor a directory containing a file named `depmanager.yml`. By default, it will look at the\r\nproject root. See the next paragraph for more information about configuration file.\r\n\r\n`kind` is used to force library kind (`shared`, `static`, `header`). By default, it uses\r\nthe value from `BUILD_SHARED_LIBS`.\r\n\r\n`target_arch`, `target_os`, `target_compiler`, `target_glibc` are used in the query. If not set, default\r\nvalues are `CMAKE_SYSTEM_PROCESSOR`, `CMAKE_SYSTEM_NAME` and `CMAKE_CXX_COMPILER_ID`\r\n\r\nThe cmake function will update the CMAKE variable for the search of package.\r\n\r\nAfter call this command, the cmake user has to call for needed `find_package`.\r\n\r\n#### Configuration file\r\n\r\nThe configuration file is a yaml file. Here is an example with explication in comment.\r\n\r\n```yaml\r\nremote:\r\n  # If server is defined, depmanager will add this server to its\r\n  # database (if not already there)\r\n  server:\r\n    # Same parameter as command-line (also the required)\r\n    name: \"my_server\"\r\n    kind: \"srvs\"\r\n    url: \"https://packages.example.net\"\r\n    login: \"foo\"\r\n    passwd: \"bar\"\r\n  # If package not found locally, do you allow for download?\r\n  pull: true\r\n  # If newer remote package exists, download it? (implies 'pull')\r\n  pull-newer: true\r\npackages:\r\n  # list the needed packages.\r\n  fmt:\r\n    # version 'at least'\r\n    version: \">=10.1.0\"\r\n  spdlog:\r\n    # exact version\r\n    version: \"1.12.0\"\r\n  debugbreak:\r\n    # if not found locally, don't pull, nor error.\r\n    optional: true\r\n  glm:\r\n    version: \"0.9.9.9\"\r\n    # force the shared version even in static build mode.\r\n    kind: \"shared\"\r\n  glfw:\r\n    # use this only for the (same for arch, and compiler)\r\n    os: Linux\r\n```\r\n\r\n### Manual mode\r\n\r\nIn manual mode you should load or find each package individually.\r\nYou should also manually set the remote and download the package.\r\n\r\n#### Find packages\r\n\r\nWith depmanager initialized in cmake, it provides an alternative to classical `find_package`\r\nof cmake by `dm_find_package`\r\n\r\n```cmake\r\ndm_find_package(\r\n   package\r\n   [QUIET] [TRACE] [REQUIRED]\r\n   [VERSION version]\r\n   [KIND kind]\r\n   [ARCH target_arch]\r\n   [OS target_os]\r\n   [COMPILER target_compiler]\r\n   [GLIBC target_glibc]\r\n)\r\n```\r\n\r\n`package` is the package name to find.\r\n\r\n`version` is the exact version to match (wildcard are allowed). By default, find the\r\nlatest one.\r\n\r\n`kind` is used to force library kind (`shared`, `static`, `header`). By default, it returns\r\nthe first found.\r\n\r\nIf `REQUIRED` set, the function will give an error if no package found.\r\n(same as original `find_package`)\r\n\r\nIf `QUIET` set, only errors are written. (same as original `find_package`). In opposition,\r\nif `TRACE` set, many more debug message displayed.\r\n\r\n`target_arch`, `target_os`, `target_compiler` `target_glibc` are used in the query. If not set, default\r\nvalues are `CMAKE_SYSTEM_PROCESSOR`, `CMAKE_SYSTEM_NAME` and `CMAKE_CXX_COMPILER_ID`\r\n\r\n**LIMITATION:** it requires the library name is the package name. So no multi lib or lib with different name.\r\n\r\n#### Load package\r\n\r\nThis command is similar to the previous one, but does not directly do a cmake's `find_package`.\r\nIt only adds to the `CMAKE_PREFIX_PATH` list the folders of given package.\r\n\r\n```cmake\r\ndm_load_package(\r\n   package\r\n   [REQUIRED] [TRACE]\r\n   [VERSION version]\r\n   [KIND kind]\r\n   [ARCH target_arch]\r\n   [OS target_os]\r\n   [COMPILER target_compiler]\r\n   [GLIBC target_glibc]\r\n)\r\n```\r\n\r\nAfter call this command, the cmake user has to call for needed `find_package`.\r\n\r\n## Create you own package\r\n\r\nDepmanager allow you to create your own packages by defining recipes. Then run\r\n`depmanager build <location of recipes> [OPTIONS]`\r\nThe program will then build and add dependencies to the local cache.\r\n\r\nThe location can contain as many recipe in any number of files.\r\n\r\nThe search behavior can bve set as recursive with option `--recursive,-r`. As sometimes, sources also contains python\r\nfiles that may fail to load, the depth of recursion can be restrained using `--recursi-depth <n>`.\r\n\r\nBy default, a package will not be build if already exists in the local cache. You can force the rebuild with the\r\noption `--force,-f`.\r\n\r\nBy default, the builder will use all the cpu cores, but `--single-thred,-s` will force to use only one core.\r\n\r\nCross-compilation can be used by giving the tools at command\r\nline: `--cross-c <C_COMPILER> --cross-cxx <CXX_COMPILER> --cross-arch <TARGET_ARCH> --cross-os <TARGET_OS>`\r\n\r\nIt is also possible to give a remote name `-n <remote_name>` or set to default remote `-d`. This way,\r\nThe builder will look into remote to see if an package already exists and pull it instead of building it.\r\nAlso, after a successful build, it will automatically push to the remote. Use either `--no-pull`and `--no-push`\r\noption to skip these steps.\r\n\r\nA `--dry-run` option will do all the checks and print the results but no pull, build and push action will be done.\r\n\r\n### The recipe\r\n\r\nDuring build, Depmanager will look in all `.py` file for class that inherits from\r\ndepmanager.api.recipe.Recipe.\r\n\r\nAs for dependency usage, build also rely on cmake for building.\r\n\r\nThe builder will use the provided recipe in the following workflow:\r\n\r\n* Init recipe\r\n* Call `recipe.source()`\r\n* Call `recipe.configure()`\r\n* Initialize options based on recipe data\r\n* Run cmake configure\r\n* For all configuration (mostly 'Debug', 'Release')\r\n    * build target `install`\r\n* Call `recipe.install()`\r\n* Generate edp.info file\r\n* Import into local cache\r\n* Call `recipe.clean()`\r\n* Clean Temporary\r\n\r\nHere is a small example\r\n\r\n```python\r\n\"\"\"\r\nSmall recipe example\r\n\"\"\"\r\nfrom depmanager.api.recipe import Recipe\r\n\r\n\r\nclass MyAwesomeLib(Recipe):\r\n    \"\"\"\r\n    Awesome lib\r\n    \"\"\"\r\n    name = \"awesome_lib\"  # lib name\r\n    version = \"0.0.1.foo\"  # lib version\r\n    source_dir = \"src\"  # where to fine the sources (especially) the CmakeList.txt\r\n    kind = \"static\"  # the lib's kind\r\n\r\n\r\nclass AnotherAwesomeLib(MyAwesomeLib):\r\n    \"\"\"\r\n    Shared version of previous one\r\n    \"\"\"\r\n    kind = \"shared\"\r\n```\r\n\r\nAs many python file may exist in the source you want to build, python file using shebang will be ignored to avoid errors\r\nwhen parsing them. Do not add shebang in your recipe files.\r\n\r\n## Roadmap\r\n\r\nFirst of all in the roadmap is to use this tool in C++ project to get feedback.\r\n\r\nAmong things:\r\n\r\n* version 0.7.x\r\n    * [ ] Creation of a frontend application.\r\n        * [ ] Can view, edit, suppress local package.\r\n        * [ ] Can add, remove, explore remotes.\r\n        * [ ] Can push, pull packages.\r\n* version 0.6.x\r\n    * [ ] Add recipe libray\r\n        * [ ] Possibility to store the recipes in remote\r\n        * [ ] Auto build recipe if neither local nor remote found.\r\n* version 0.5.x\r\n    * [ ] Add a sorting order for remotes.\r\n        * [ ] Searching across remotes with final package sorting.\r\n        * [ ] Allow auto-pull best-fitting package\r\n* version 0.4.x\r\n    * [ ] Add concept of toolset.\r\n        * [ ] Tool set defines arch, os and compilers; stored in config.ini; with a default one.\r\n        * [ ] Use toolset in build.\r\n        * [ ] Use toolset in queries.\r\n    * [ ] More detail documentation.\r\n        * [ ] Documentation hosted in instance of [Depmanager Server](https://github.com/Silmaen/DepManagerServer).\r\n* version 0.3.3 -- 2024-01-27\r\n    * [X] Improved Builder Configurations management\r\n    * [X] Operation on multiple package\r\n        * [X] add a 'clean' command\r\n            * [X] basic mode: keep only the newest packages\r\n            * [X] full mode: delete everything.\r\n        * [X] allow local deletion of multiple packages\r\n        * [X] allow push/pull of multiple packages\r\n* version 0.3.2 -- 2024-01-19\r\n    * [X] Better management of push in auto-build\r\n    * [X] Bugfixes in the use of CMake\r\n    * [X] manage dependency in the list of Recipes\r\n* version 0.3.1 -- 2024-01-16\r\n    * [X] Allow to externally control the build system\r\n        * [X] Allow to build a package by giving a single recipe\r\n        * [X] Allow to pull packages prior to build if exists on a remote\r\n        * [X] Allow to push (force) to remote after build\r\n    * [X] Helper functions to find recipes in filesystem\r\n        * [X] Allow recursive search\r\n* version 0.3.0 -- 2024-01-12\r\n    * [X] CMake integration improvement\r\n        * [X] Simplify integration with cmake\r\n        * [X] Python auto generate the Module dir for cmake\r\n        * [X] Allow to load package by batch\r\n            * [X] use Yaml config file.\r\n* version 0.2.1 -- 2023-12-31\r\n    * [X] Bufix: allow more date format and don't break if bad format.\r\n* version 0.2.0 -- 2023-12-12\r\n    * WARNING: Some breaking change. Backward compatibility not fully tested.\r\n    * [X] Faster commandline\r\n        * [X] Use remote connexion only if needed\r\n    * [X] Transitive search\r\n        * [X] Query: search in local then remote.\r\n        * [X] get: Auto-pull if not in local.\r\n    * [X] Add new remote command.\r\n        * [X] Get info from remote (type and version)\r\n        * [X] Allow to delete package on remote.\r\n    * [X] Better Package properties\r\n        * [X] Add build Date in package properties.\r\n        * [X] Add build glibc version in package properties if applicable.\r\n        * [X] Better queries on glibc compatible system\r\n        * [X] Use system's glibc in get searches\r\n* version 0.1.4 -- 2023-06-21\r\n    * [X] Allow to sync with remote.\r\n        * [X] Allow to pull local package that have newer version.\r\n        * [X] Allow to push local package newer than remote or not existing in remote.\r\n    * [X] Allow to force push/pull.\r\n    * [X] Bugfix: safe delete\r\n* version 0.1.3 -- 2023-06-12\r\n    * [X] Update internal statuses when using API.\r\n    * [X] omit -d in push/pull command.\r\n    * [X] add progress bar in push/pull command.\r\n    * [X] Allow single thread in build.\r\n* version 0.1.2 -- 2023-05-31\r\n    * [X] Add possibility to force os, arch and compiler for cross compiling.\r\n    * [X] Adapt build system to search dependency in the forced environment.\r\n* version 0.1.1\r\n    * [X] Add remote 'srv' Type: a dedicated dependency server.\r\n    * [X] Add remote 'srvs' Type: a dedicated dependency server with secure connexion.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Silmaen  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Simple Dependency manager",
    "version": "0.3.3",
    "project_urls": {
        "Homepage": "https://github.com/Silmaen/DepManager"
    },
    "split_keywords": [
        "dependency",
        "development",
        "cmake",
        "c++"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0521952a0f09e192cba9e634a7910ef7f54c06bcbfdd5bc0dc10a2c08ba23bc",
                "md5": "51bb862782d67d7ab0f7a0290b104d58",
                "sha256": "c8268b4acd242088fa9f1d9358fbe57f2a9e44b6c6e73739e448cdcdc31e55d3"
            },
            "downloads": -1,
            "filename": "depmanager-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "51bb862782d67d7ab0f7a0290b104d58",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 55533,
            "upload_time": "2024-01-27T12:48:46",
            "upload_time_iso_8601": "2024-01-27T12:48:46.757711Z",
            "url": "https://files.pythonhosted.org/packages/d0/52/1952a0f09e192cba9e634a7910ef7f54c06bcbfdd5bc0dc10a2c08ba23bc/depmanager-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6d9bd7ecb5729fa40305ee9ead35b8f1d7b74c5595dfe66fae095895e787630f",
                "md5": "3bad05ccbb5c4153d436e9cfb9a58c7c",
                "sha256": "976d88606541af5c575f4352e40dbf0655dba3f01b01c567caeb7dddae5aedd4"
            },
            "downloads": -1,
            "filename": "depmanager-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3bad05ccbb5c4153d436e9cfb9a58c7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 50244,
            "upload_time": "2024-01-27T12:48:48",
            "upload_time_iso_8601": "2024-01-27T12:48:48.671492Z",
            "url": "https://files.pythonhosted.org/packages/6d/9b/d7ecb5729fa40305ee9ead35b8f1d7b74c5595dfe66fae095895e787630f/depmanager-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-27 12:48:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Silmaen",
    "github_project": "DepManager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "depmanager"
}
        
Elapsed time: 0.17206s