Skip to content

Commit

Permalink
conanfile improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Oct 24, 2024
1 parent 241ffba commit cd5e0f2
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
from conan.tools.scm import Git, Version
from conan.tools.scm import Git
from conan.tools.files import update_conandata, download, unzip

Check notice on line 6 in conanfile.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

conanfile.py#L6

'conan.tools.files.update_conandata' imported but unused (F401)

Check warning on line 6 in conanfile.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

conanfile.py#L6

Unused update_conandata imported from conan.tools.files

required_conan_version = ">=2.0"

class DPPConan(ConanFile):
name = "dpp"
version = "10.0.33"
default_user = "brainboxdotcc"
default_channel = "testing"
license = "https://github.com/brainboxdotcc/DPP/blob/master/LICENSE"
license = "Apache-2.0"
url = "https://github.com/brainboxdotcc/DPP"
description = "D++ is a lightweight and efficient library for Discord"
topics = ("discord")
Expand All @@ -25,24 +22,9 @@ class DPPConan(ConanFile):
def _min_cppstd(self):
return 17

@property
def _compilers_minimum_version(self):
return {
"gcc": "8",
"clang": "11",
"apple-clang": "14",
"Visual Studio": "17",
"msvc": "193",
}

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."
)

def requirements(self):
self.requires("nlohmann_json/3.11.2")
Expand All @@ -63,8 +45,7 @@ def layout(self):

def export(self):
git = Git(self, self.recipe_folder)
scm_url, scm_commit = git.get_url_and_commit()
update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}})
git.coordinates_to_conandata()

def source(self):
zip_name = "DPP.zip"
Expand Down

0 comments on commit cd5e0f2

Please sign in to comment.