Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpc: Update docs examples - chore no os.rename #5961

Merged
merged 2 commits into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions recipes/mpc/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from conans.errors import ConanInvalidConfiguration
import os

required_conan_version = ">=1.33.0"

class MpcConan(ConanFile):
name = "mpc"
Expand All @@ -15,30 +16,31 @@ class MpcConan(ConanFile):
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
exports_sources = "patches/**"
_autotools = None

@property
def _source_subfolder(self):
return "source_subfolder"

_autotools = None

def config_options(self):
if self.settings.os == 'Windows':
del self.options.fPIC

def requirements(self):
self.requires("mpfr/4.1.0")

def configure(self):
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration("The mpc package cannot be built on Visual Studio.")
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def validate(self):
if self.settings.compiler == "Visual Studio":
raise ConanInvalidConfiguration("The mpc package cannot be built on Visual Studio.")

def requirements(self):
self.requires("mpfr/4.1.0")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)

def _configure_autotools(self):
if self._autotools:
Expand All @@ -63,7 +65,7 @@ def package(self):
autotools = self._configure_autotools()
autotools.install()
tools.rmdir(os.path.join(self.package_folder, "share"))
os.unlink(os.path.join(self.package_folder, "lib", "libmpc.la"))
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la")

def package_info(self):
self.cpp_info.libs = ["mpc"]