-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into mpir-relocatable-macos
- Loading branch information
Showing
145 changed files
with
2,227 additions
and
496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "recipe_linter_errors", | ||
"severity": "error", | ||
"pattern": [ | ||
{ | ||
"regexp": "(\\S+):(\\d+):(\\d+):\\s(E\\d+):\\s(.+)\\s\\((\\S+)\\)", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 5, | ||
"code": 4 | ||
} | ||
] | ||
}, | ||
{ | ||
"owner": "recipe_linter_warnings", | ||
"severity": "warning", | ||
"pattern": [ | ||
{ | ||
"regexp": "(\\S+):(\\d+):(\\d+):\\s(W\\d+):\\s(.+)\\s\\((\\S+)\\)", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 5, | ||
"code": 4 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import os | ||
import yaml | ||
import requests | ||
import packaging.version | ||
import subprocess | ||
import platform | ||
import sys | ||
|
||
|
||
def main(pr): | ||
session = requests.session() | ||
session.headers = {} | ||
token = os.getenv("GH_TOKEN") | ||
if token: | ||
session.headers["Authorization"] = "token %s" % token | ||
|
||
session.headers["Accept"] = "application/vnd.github.v3+json" | ||
session.headers["User-Agent"] = "request" | ||
session.auth = None | ||
# if user and pw: | ||
# session.auth = requests.auth.HTTPBasicAuth(user, pw) | ||
|
||
github_server_url = os.getenv("GITHUB_SERVER_URL") | ||
github_repo = os.getenv("GITHUB_REPOSITORY") | ||
|
||
r = session.request("GET", f"{github_server_url}/{github_repo}/pull/{pr}.diff") | ||
r.raise_for_status() | ||
diff = r.text | ||
packages = set() | ||
for line in diff.split("\n"): | ||
if line.startswith("+++ b/recipes/") or line.startswith("--- a/recipes/"): | ||
parts = line.split("/") | ||
if len(parts) >= 5: | ||
packages.add(parts[2] + "/" + parts[3]) | ||
for line in packages: | ||
package = line.split("/")[0] | ||
version = None | ||
folder = line.split("/")[1] | ||
with open(os.path.join("recipes", package, "config.yml"), "r") as file: | ||
config = yaml.safe_load(file) | ||
for v in config["versions"]: | ||
if config["versions"][v]["folder"] != folder: | ||
continue | ||
try: | ||
if not version or packaging.version.Version(v) > packaging.version.Version(version): | ||
version = v | ||
except packaging.version.InvalidVersion: | ||
print("Error parsing version %s for package %s in pr %s" % (v, package, pr)) | ||
|
||
if version: | ||
shell = bool(platform.system() != "Windows") | ||
command = "conan export %s %s/%s@" % (os.path.join("recipes", package, folder), package, version) | ||
p = subprocess.run(command, shell=shell, check=False) | ||
|
||
if __name__ == "__main__": | ||
# execute only if run as a script | ||
main(sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: run linters | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
env: | ||
CONAN_YAMLLINT_WERR: 1 | ||
CONAN_PYLINT_WERR: 1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
hook: ["yaml_linter", "recipe_linter"] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2.2.2 | ||
with: | ||
python-version: "3.8" | ||
|
||
- run: "pip3 install conan yamllint packaging pylint==2.10.2 astroid" | ||
|
||
- name: install hook | ||
run: | | ||
conan config install https://github.com/conan-io/hooks.git | ||
conan config set hooks.${{ matrix.hook }} | ||
- name: run lint | ||
run: | | ||
echo "::add-matcher::.github/${{ matrix.hook }}.json" | ||
python3 .github/runlint.py ${{ github.event.pull_request.number }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "yaml_linter", | ||
"pattern": [ | ||
{ | ||
"regexp": "^\\[HOOK\\s-\\syaml_linter\\.py\\]\\spre_export\\(\\):\\s(.+):(\\d+):(\\d+):\\s\\[(\\S+)\\]\\s(.+)\\s\\((.+)\\)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5, | ||
"code": 6 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sources: | ||
"0.8.20": | ||
url: "https://github.com/AravisProject/aravis/releases/download/0.8.20/aravis-0.8.20.tar.xz" | ||
sha256: "0c0eb5a76109f29180c09c7e6a23fd403633bf22bbe8468a0ae44995c4449f46" | ||
patches: | ||
"0.8.20": | ||
- patch_file: "patches/0.8.19-gst-shared-lib.patch" | ||
base_path: "source_subfolder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
from conans import ConanFile, Meson, RunEnvironment, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
import glob | ||
|
||
|
||
class AravisConan(ConanFile): | ||
name = "aravis" | ||
license = "LGPL-2.1-or-later" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/AravisProject/aravis" | ||
description = "A vision library for genicam based cameras." | ||
topics = ("usb", "camera") | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"usb": [True, False], | ||
"packet_socket": [True, False], | ||
"gst_plugin": [True, False], | ||
"tools": [True, False], | ||
"introspection": [True, False] | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"usb": True, | ||
"packet_socket": True, | ||
"gst_plugin": False, | ||
"tools": True, | ||
"introspection": False | ||
} | ||
generators = "pkg_config" | ||
|
||
_meson = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
|
||
@property | ||
def _aravis_api_version(self): | ||
return ".".join(self.version.split(".")[0:2]) | ||
|
||
@property | ||
def _is_msvc(self): | ||
return self.settings.compiler == "Visual Studio" | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
if self.settings.os != "Linux": | ||
del self.options.packet_socket | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
self.options["glib"].shared = True | ||
|
||
def validate(self): | ||
if self._is_msvc and self.settings.get_safe("compiler.runtime", "").startswith("MT"): | ||
raise ConanInvalidConfiguration("Static MT/MTd runtime is not supported on Windows due to GLib issues") | ||
if not self.options["glib"].shared and self.options.shared: | ||
raise ConanInvalidConfiguration("Shared Aravis cannot link to static GLib") | ||
if self.settings.os == "Macos": | ||
raise ConanInvalidConfiguration("macOS builds are disabled until conan-io/conan#7324 gets merged to fix macOS SIP issue #8443") | ||
|
||
def build_requirements(self): | ||
self.build_requires("meson/0.60.2") | ||
self.build_requires("pkgconf/1.7.4") | ||
if self.options.introspection: | ||
self.build_requires("gobject-introspection/1.70.0") | ||
|
||
def requirements(self): | ||
self.requires("glib/2.70.1") | ||
self.requires("libxml2/2.9.12") | ||
self.requires("zlib/1.2.11") | ||
if self.options.usb: | ||
self.requires("libusb/1.0.24") | ||
if self.options.gst_plugin: | ||
self.requires("gstreamer/1.19.2") | ||
self.requires("gst-plugins-base/1.19.2") | ||
|
||
def export_sources(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
self.copy(patch["patch_file"]) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) | ||
|
||
def _patch_sources(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
|
||
def _configure_meson(self): | ||
if self._meson: | ||
return self._meson | ||
defs = dict() | ||
defs["wrap_mode"] = "nofallback" | ||
defs["usb"] = "enabled" if self.options.usb else "disabled" | ||
defs["gst-plugin"] = "enabled" if self.options.gst_plugin else "disabled" | ||
defs["packet-socket"] = "enabled" if self.options.get_safe("packet_socket") else "disabled" | ||
defs["introspection"] = "enabled" if self.options.introspection else "disabled" | ||
defs["viewer"] = "disabled" | ||
defs["tests"] = "false" | ||
defs["documentation"] = "disabled" | ||
if self.settings.get_safe("compiler.runtime"): | ||
defs["b_vscrt"] = str(self.settings.compiler.runtime).lower() | ||
self._meson = Meson(self) | ||
self._meson.configure(defs=defs, source_folder=self._source_subfolder, build_folder=self._build_subfolder) | ||
return self._meson | ||
|
||
def build(self): | ||
self._patch_sources() | ||
with tools.environment_append(RunEnvironment(self).vars): | ||
meson = self._configure_meson() | ||
meson.build() | ||
|
||
def _fix_library_names(self, path): | ||
# https://github.com/mesonbuild/meson/issues/1412 | ||
if not self.options.shared and self._is_msvc: | ||
with tools.chdir(path): | ||
for filename_old in glob.glob("*.a"): | ||
filename_new = filename_old[3:-2] + ".lib" | ||
self.output.info("rename %s into %s" % (filename_old, filename_new)) | ||
tools.rename(filename_old, filename_new) | ||
|
||
def package(self): | ||
self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) | ||
with tools.environment_append(RunEnvironment(self).vars): | ||
meson = self._configure_meson() | ||
meson.install() | ||
|
||
self._fix_library_names(os.path.join(self.package_folder, "lib")) | ||
if self.options.gst_plugin: | ||
self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | ||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) | ||
tools.remove_files_by_mask(self.package_folder, "*.pdb") | ||
if not self.options.tools: | ||
tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "arv-*") | ||
|
||
def package_id(self): | ||
self.info.requires["glib"].full_package_mode() | ||
if self.options.gst_plugin: | ||
self.info.requires["gstreamer"].full_package_mode() | ||
self.info.requires["gst-plugins-base"].full_package_mode() | ||
|
||
def package_info(self): | ||
aravis_name = "aravis-{}".format(self._aravis_api_version) | ||
self.cpp_info.names["pkg_config"] = aravis_name | ||
self.cpp_info.includedirs = [os.path.join("include", aravis_name)] | ||
self.cpp_info.libs = [aravis_name] | ||
if self.settings.os == "Linux": | ||
self.cpp_info.system_libs.extend(["dl", "pthread", "m", "resolv"]) | ||
elif self.settings.os == "Windows": | ||
self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) | ||
|
||
if self.options.tools: | ||
bin_path = os.path.join(self.package_folder, "bin") | ||
self.output.info("Appending PATH environment variable: {}".format(bin_path)) | ||
self.env_info.PATH.append(bin_path) | ||
if self.options.gst_plugin and self.options.shared: | ||
gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | ||
self.output.info("Appending GST_PLUGIN_PATH env var: {}".format(gst_plugin_path)) | ||
self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/gst/meson.build | ||
+++ b/gst/meson.build | ||
@@ -15,7 +15,7 @@ gst_c_args = [ | ||
|
||
gst_plugin_filename = 'gstaravis.@0@'.format (aravis_api_version) | ||
|
||
-gst_plugin = shared_library (gst_plugin_filename, | ||
+gst_plugin = library (gst_plugin_filename, | ||
gst_sources, gst_headers, | ||
name_suffix: [], | ||
link_with: aravis_library, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package LANGUAGES C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(aravis REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} aravis::aravis) |
Oops, something went wrong.