Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Croydon committed Jun 16, 2024
1 parent 11dbf77 commit 8afa870
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion tests/files/conan_1_expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def configure(self):
raise ConanInvalidConfiguration("Double Convertion could not be built by MSVC <14")

def source(self):
tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version))
tools.get(f"{self.homepage}/archive/v{self.version}.tar.gz")
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)

Expand Down
32 changes: 14 additions & 18 deletions tests/files/conan_1_old.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from conans import ConanFile, CMake, tools
from conans.model.version import Version
from conans.errors import ConanInvalidConfiguration
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.scm import Version
from conans import CMake, tools
import os

# Conanfiles aren't executables, don't add a hashbang
Expand All @@ -15,17 +13,15 @@ class DoubleConversionConan(ConanFile):
version = "3.0.0"
url = "https://github.com/bincrafters/conan-double-conversion"
homepage = "https://github.com/google/double-conversion"
author = "Bincrafters <[email protected]>"
description = "Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles."
license = "MIT"
exports = ["LICENSE.md"]
exports_sources = ["CMakeLists.txt"]
generators = "cmake"
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = "shared=False", "fPIC=True"
source_subfolder = "source_subfolder"
build_subfolder = "build_subfolder"
default_options = {'shared': False, 'fPIC': True}
_source_subfolder = "source_subfolder"
_build_subfolder = "build_subfolder"

def config_options(self):
if self.settings.os == "Windows":
Expand All @@ -40,22 +36,22 @@ def configure(self):
def source(self):
tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version))
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self.source_subfolder)
os.rename(extracted_dir, self._source_subfolder)

def configure_cmake(self):
def _configure_cmake(self):
cmake = CMake(self)
cmake.configure(build_folder=self.build_subfolder)
cmake.configure(build_folder=self._build_subfolder)
return cmake

def build(self):
cmake = self.configure_cmake()
cmake = self._configure_cmake()
cmake.build()

def package(self):
cmake = self.configure_cmake()
cmake = self._configure_cmake()
cmake.install()
self.copy(pattern="LICENSE", dst="licenses", src=self.source_subfolder, keep_path=False)
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder, keep_path=False)

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.cppflags = ["-pthread"]
self.cpp_info.cxxflags = ["-pthread"]
2 changes: 1 addition & 1 deletion tests/files/conan_multiline_options_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def configure(self):
raise ConanInvalidConfiguration("Double Convertion could not be built by MSVC <14")

def source(self):
tools.get("{0}/archive/v{1}.tar.gz".format(self.homepage, self.version))
tools.get(f"{self.homepage}/archive/v{self.version}.tar.gz")
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self.source_subfolder)

Expand Down

0 comments on commit 8afa870

Please sign in to comment.