(#21684) dependencies: new recipe

This commit is contained in:
Martin Valgur
2023-12-12 23:38:29 +02:00
committed by GitHub
parent 7b258139f1
commit d8cb8f4d17
4 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
sources:
"1.11.1":
"x86_64":
url: "https://github.com/lucasg/Dependencies/releases/download/v1.11.1/Dependencies_x64_Release.zip"
sha256: "7d22dc00f1c09fd4415d48ad74d1cf801893e83b9a39944b0fce6dea7ceaea99"
"x86":
url: "https://github.com/lucasg/Dependencies/releases/download/v1.11.1/Dependencies_x86_Release.zip"
sha256: "3e6bc62b4163c4e8035e8a597515c116343fcb76fa4315317c3cafe0bdc9e257"
"license":
url: "https://raw.githubusercontent.com/lucasg/Dependencies/v1.11.1/LICENSE"
sha256: "5d7cbf9b08285c1f89e4f4f1341090c662f4078dbf7ce8a7d392d2482e550fb6"

View File

@@ -0,0 +1,50 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import copy, get, download
import os
required_conan_version = ">=1.47.0"
class PackageConan(ConanFile):
name = "dependencies"
description = ("Dependencies can help Windows developers troubleshooting their DLL-loading dependency issues. "
"It is a rewrite of the legacy Dependency Walker software, which was shipped along Windows SDKs, "
"but whose development stopped around 2006.")
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/lucasg/Dependencies"
topics = ("windows", "dll", "debugging", "pre-built")
package_type = "application"
settings = "os", "arch", "compiler", "build_type"
def package_id(self):
del self.info.settings.compiler
del self.info.settings.build_type
def validate(self):
if self.settings.os != "Windows":
raise ConanInvalidConfiguration("Dependencies is only available on Windows")
if self.settings.arch not in ["x86_64", "x86"]:
raise ConanInvalidConfiguration("Dependencies is only available for x86_64 and x86 architectures")
def build(self):
get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], strip_root=False)
download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE")
def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
copy(self, "*.exe", self.source_folder, os.path.join(self.package_folder, "bin"))
copy(self, "*.dll", self.source_folder, os.path.join(self.package_folder, "bin"),
excludes=["msvcp*.dll", "msvcr*.dll", "vcruntime*.dll"])
copy(self, "*.config", self.source_folder, os.path.join(self.package_folder, "bin"))
def package_info(self):
self.cpp_info.frameworkdirs = []
self.cpp_info.libdirs = []
self.cpp_info.resdirs = []
self.cpp_info.includedirs = []
# TODO: Legacy, to be removed on Conan 2.0
bin_folder = os.path.join(self.package_folder, "bin")
self.env_info.PATH.append(bin_folder)

View File

@@ -0,0 +1,22 @@
import sys
from conan import ConanFile
from conan.tools.cmake import cmake_layout
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "VirtualBuildEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
def test(self):
self.run(f"dependencies -chain -depth 1 {sys.executable}")
# FYI, you can get similar info with a VCVars generator and
# self.run(f"dumpbin /imports {sys.executable}")

View File

@@ -0,0 +1,3 @@
versions:
"1.11.1":
folder: all