summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2014-06-20 15:41:32 +0100
committerMichael Williamson <mike@zwobble.org>2014-06-20 15:41:32 +0100
commitae3c18ef2934b88d0aedd0567a410ce23bb95ceb (patch)
treee8bc0f9604f90423b8d80e6bd8ffc36adb12c09b /setup.py
parent95a58530b122a94dc503ad51b736c24768197a81 (diff)
Remove dependency on git
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/setup.py b/setup.py
index d2b8f2e..0185e01 100644
--- a/setup.py
+++ b/setup.py
@@ -2,10 +2,17 @@
import os
import subprocess
+import tarfile
+import shutil
+
from setuptools import setup
from distutils.extension import Extension
from distutils.command.build_ext import build_ext
+try:
+ from urllib import urlretrieve
+except ImportError:
+ from urllib.request import urlretrieve
def path_in_dir(relative_path):
return os.path.join(os.path.dirname(__file__), relative_path)
@@ -14,29 +21,24 @@ def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
-jq_lib_dir = path_in_dir("_jq-lib")
+tarball_path = path_in_dir("_jq-lib-1.4.tar.gz")
+jq_lib_dir = path_in_dir("jq-jq-1.4")
class jq_build_ext(build_ext):
def run(self):
+ if os.path.exists(tarball_path):
+ os.unlink(tarball_path)
+ urlretrieve("https://github.com/stedolan/jq/archive/jq-1.4.tar.gz", tarball_path)
- def command(args):
- subprocess.check_call(args, cwd=path_in_dir(jq_lib_dir))
-
if os.path.exists(jq_lib_dir):
- command(["git", "fetch"])
- command(["git", "checkout", "jq-1.4"])
- else:
- subprocess.check_call([
- "git", "clone",
- "https://github.com/stedolan/jq.git",
- jq_lib_dir
- ])
- command(["git", "checkout", "jq-1.4"])
+ shutil.rmtree(jq_lib_dir)
+ tarfile.open(tarball_path, "r:gz").extractall(path_in_dir("."))
+
+ def command(args):
+ subprocess.check_call(args, cwd=jq_lib_dir)
- command(["mkdir", "-p", "m4"])
command(["autoreconf", "-i"])
command(["./configure", "CFLAGS=-fPIC"])
- command(["make", "clean"])
command(["make"])
build_ext.run(self)