Fix git checkout

This commit is contained in:
Christoph Gerum 2022-05-16 10:15:24 +02:00
parent db98e3a9c0
commit a00d71c69f
1 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,6 @@
from conans import ConanFile, AutoToolsBuildEnvironment, tools from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os import os
import shutil
class TccConan(ConanFile): class TccConan(ConanFile):
name = "tcc" name = "tcc"
@ -19,14 +20,15 @@ class TccConan(ConanFile):
exports_sources = "tcc-%s/*" % version exports_sources = "tcc-%s/*" % version
def source(self): def source(self):
if self.revsion: if self.revision:
self.output.info("Cloning from %s" % self.git_repo)
git = tools.Git(folder=self.sub_folder) git = tools.Git(folder=self.sub_folder)
if not os.path.exists(self.sub_folder): if os.path.exists(self.sub_folder):
git.clone(self.git_repo) shutil.rmtree(self.sub_folder)
git.pull() git.clone(self.git_repo)
git.checkout(self.revision) git.checkout(self.revision)
else: else:
self.output.info("Downloading %s" %self.source_tar) self.output.info("Downloading %s" % self.source_tar)
tools.download(self.source_tar, "tcc.tar.bz2") tools.download(self.source_tar, "tcc.tar.bz2")
tools.unzip("tcc.tar.bz2") tools.unzip("tcc.tar.bz2")
os.remove("tcc.tar.bz2") os.remove("tcc.tar.bz2")