from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os


class InputprotoConan(ConanFile):
    name = "inputproto"
    version = "2.3.2"
    license = "Custom https://cgit.freedesktop.org/xorg/proto/inputproto/tree/COPYING"
    url = "https://github.com/trigger-happy/conan-packages"
    description = "X11 Input extension wire protocol"
    settings = "os", "compiler", "build_type", "arch"
    options = {"shared": [True, False]}
    default_options = "shared=False"
    generators = "cmake"

    def source(self):
        pkgLink = 'https://xorg.freedesktop.org/releases/individual/proto/inputproto-{version}.tar.bz2'.format(version=self.version)
        self.run("curl -JOL " + pkgLink)
        self.run("tar xf inputproto-{version}.tar.bz2".format(version=self.version))

    def build(self):
        envBuild = AutoToolsBuildEnvironment(self)
        installPrefix=os.getcwd()
        with tools.chdir("inputproto-{version}".format(version=self.version)):
            with tools.environment_append(envBuild.vars):
                self.run("./configure --prefix={0}".format(installPrefix))
                self.run("make install")

    def package(self):
        self.copy("lib/*", dst=".", keep_path=True)
        self.copy("include/*", dst=".", keep_path=True)

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

@@ -56,16 +56,46 @@
 , tools%0A
+import urllib3%0Aimport tarfile%0A
 import o
@@ -636,39 +636,33 @@
 oto/inputproto-%7B
-version
+0
 %7D.tar.bz2'.forma
@@ -667,154 +667,465 @@
 mat(
+self.
 version
-=self.version)%0A        self.run(%22curl -JOL %22 + pkgLink)%0A        self.run(%22tar xf inputproto-%7Bversion%7D.tar.bz2%22.format(version=self.version)
+)%0A        fileName = 'inputproto-%7B0%7D.tar.bz2'.format(self.version)%0A        pool = urllib3.PoolManager()%0A        request = pool.request('GET', pkgLink)%0A        if request.status == 200:%0A            f = open(fileName, 'w')%0A            f.write(request.data)%0A            f.close()%0A            tf = tarfile.open(fileName)%0A            tf.extractall('.')%0A            tf.close()%0A        else:%0A            raise Exception('Could not download source file'
 )%0A%0A 

Improve inputproto package