Skip to content

Instantly share code, notes, and snippets.

@puetzk
Created February 2, 2019 00:47
Show Gist options
  • Save puetzk/d8553b06827ec4f2071c2428b118bd88 to your computer and use it in GitHub Desktop.
Save puetzk/d8553b06827ec4f2071c2428b118bd88 to your computer and use it in GitHub Desktop.
example files for conan patch adding files interaction with strip=1
from conans import ConanFile, tools
class PatchConan(ConanFile):
name = "patch"
version = "1.0"
settings = "os", "compiler", "build_type", "arch"
exports_sources = ["example.patch"]
def source(self):
self.run("git clone https://github.com/memsharded/hello.git")
self.run("cd hello && git checkout static_shared")
tools.patch(self.source_folder, "example.patch",strip=1)
Index: src/hello/goodbye.cpp
===================================================================
--- /dev/null
+++ src/hello/goodbye.cpp
@@ -0,0 +1,6 @@
+#include <iostream>
+#include "hello.h"
+
+void goodbye(){
+ std::cout << "Goodbye!\n";
+}
Index: src/hello/hello.cpp
===================================================================
--- src.orig/hello/hello.cpp
+++ src/hello/hello.cpp
@@ -2,5 +2,5 @@
#include "hello.h"
void hello(){
- std::cout << "Hello World!\n";
-}
\ No newline at end of file
+ std::cout << "Hello Universe!\n";
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment