 -            shutil.rmtree(d)
 -        except OSError:
 -            pass
--
+ 
+ libraries = ["jq", "onig"]
+-if platform.architecture()[1] == 'WindowsPE':
+-    libraries.append("shlwapi")
  
  pyjq = Extension(
      "_pyjq",
      sources=["_pyjq.c"],
 -    include_dirs=["dependencies/jq_install/include"],
--    libraries=["jq", "onig"],
+     libraries=libraries,
 -    library_dirs=["dependencies/jq_install/lib", "dependencies/onig_install/lib"]
-+    libraries=["jq", "onig"]
  )
  
  setup(
-@@ -102,7 +53,6 @@ setup(
+@@ -103,7 +54,6 @@
      author='OMOTO Kenji',
      url='http://github.com/doloopwhile/pyjq',
      license='MIT License',

diff -rupN pyjq-2.2.0/setup.py pyjq-2.2.0-patched/setup.py
--- pyjq-2.2.0/setup.py	2017-08-01 15:06:36.000000000 -0400
+++ pyjq-2.2.0-patched/setup.py	2017-08-01 15:16:39.000000000 -0400
@@ -6,7 +6,12 @@ import tarfile
 import shutil
 from os.path import join, dirname, abspath
 
-import sysconfig
+try:

 from setuptools import setup
 from setuptools.extension import Extension
 from setuptools.command.build_ext import _build_ext
 
 long_description = io.open('README.rst', encoding='utf-8').read()
 
-dependencies_dir_path = join(abspath(dirname(__file__)), "dependencies")
-
-onig_tarball_path = join(dependencies_dir_path, "onig-6.9.0.tar.gz")
-onig_install_path = join(dependencies_dir_path, "onig_install")
-onig_source_path = join(dependencies_dir_path, "onig-6.9.0")
-
-jq_tarball_path = join(dependencies_dir_path, "jq-1.5.tar.gz")
-jq_install_path = join(dependencies_dir_path, "jq_install")
