Skip to content

Commit

Permalink
Add audria recipe
Browse files Browse the repository at this point in the history
Which is a neat little resource monitor tool for Unix

Contributes to NP-31
  • Loading branch information
jellespijker committed Feb 7, 2024
1 parent bf9d76f commit c546481
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
5 changes: 5 additions & 0 deletions recipes/audria/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sources:
"cci.20220429":
url:
- "https://github.com/scaidermern/audria/archive/18963ec93571387c330e0fde677425097c280671.zip"
sha256: "9418f94c6b75f03dcb39e2e6447f413af7978146b852a2eeb15449aaf7f3b26f"
71 changes: 71 additions & 0 deletions recipes/audria/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.files import apply_conandata_patches, copy, get
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
import os


required_conan_version = ">=1.54.0"


class PackageConan(ConanFile):
name = "audria"
description = "A Utility for Detailed Ressource Inspection of Applications"
license = " AGPL-3.0-or-later"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/scaidermern/audria"
topics = ("statistics", "cpu", "monitor", "monitoring", "profiler", "memory", "resources", "analyzer", "io", "load", "throughput", "inspection", "profiling", "threads", "cpu-monitoring", "resource-measurement", "memory-usage", "cpu-usage", "memory-monitoring")
package_type = "application"
settings = "os", "arch", "compiler", "build_type"

@property
def _min_cppstd(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"apple-clang": "10",
"clang": "7",
"gcc": "7",
}

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def layout(self):
basic_layout(self, src_folder="src")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
if self.settings.os not in ["Linux", "FreeBSD", "Macos"]:
raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
copy(self, "*", src=self.source_folder, dst=self.build_folder)

def build(self):
apply_conandata_patches(self)
self.run("make")

def package(self):
copy(self, "audria", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"))

def package_info(self):
self.cpp_info.bins = ["audria"]

bindir = os.path.join(self.package_folder, "bin")
self.output.info(f"Appending PATH environment variable: {bindir}")
self.env_info.PATH.append(bindir)
17 changes: 17 additions & 0 deletions recipes/audria/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conan import ConanFile
from conan.tools.build import can_run
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def test(self):
if can_run(self):
bin_path = os.path.join("audria")
self.run(f"{bin_path} -h", env="conanrun")
3 changes: 3 additions & 0 deletions recipes/audria/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"cci.20220429":
folder: all

0 comments on commit c546481

Please sign in to comment.