From 2fc2aeb3e74460c109b15609031de1551570f228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Wed, 26 May 2021 19:30:27 +0200
Subject: [PATCH] fix coverage

---
 .travis.yml                           |  1 -
 Dockerfile                            |  1 -
 README.md                             |  6 +----
 minijson/routines.pyx => minijson.pyx | 17 +++++++++++-
 minijson/__init__.py                  |  3 ---
 minijson/exceptions.pyx               | 14 ----------
 minijson/routines.pxd                 | 11 --------
 requirements.txt                      |  2 --
 setup.py                              | 37 ++++++++++-----------------
 9 files changed, 31 insertions(+), 61 deletions(-)
 rename minijson/routines.pyx => minijson.pyx (98%)
 delete mode 100644 minijson/__init__.py
 delete mode 100644 minijson/exceptions.pyx
 delete mode 100644 minijson/routines.pxd

diff --git a/.travis.yml b/.travis.yml
index 12addb7..ae1831d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,6 @@ before_script:
   - pip install -r requirements.txt
   - pip install pytest coverage pytest-cov
   - DEBUG=1 python setup.py install
-  - rm -rf minijson
 jobs:
   include:
     - stage: test
diff --git a/Dockerfile b/Dockerfile
index 7a93d2b..1d32eca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,6 +8,5 @@ WORKDIR /tmp/compile
 ADD . /tmp/compile/
 
 RUN python setup.py install
-RUN rm -rf minijson
 
 CMD ["pytest", "--cov=./", "--cov-report=xml"]
diff --git a/README.md b/README.md
index 4ca0bc0..01b88e9 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,4 @@ for use.
 
 If there are no binary wheels precompiled for this platform, you will need to compile it yourself.
 
-In order to do that you must have the following packages installed:
-
-* snakehouse
-* satella
-* Cython
+In order to do that you must have `Cython` installed.
diff --git a/minijson/routines.pyx b/minijson.pyx
similarity index 98%
rename from minijson/routines.pyx
rename to minijson.pyx
index bce59de..44ba8c6 100644
--- a/minijson/routines.pyx
+++ b/minijson.pyx
@@ -2,7 +2,22 @@ import typing as tp
 import io
 import struct
 
-from minijson.exceptions import DecodingError, EncodingError
+
+class MiniJSONError(ValueError):
+    """
+    Base class for MiniJSON errors.
+
+    Note that it inherits from :code:`ValueError`.
+    """
+
+
+class EncodingError(MiniJSONError):
+    """Error during encoding"""
+
+
+class DecodingError(MiniJSONError):
+    """Error during decoding"""
+
 
 STRUCT_f = struct.Struct('>f')
 STRUCT_d = struct.Struct('>d')
diff --git a/minijson/__init__.py b/minijson/__init__.py
deleted file mode 100644
index 5308c40..0000000
--- a/minijson/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from .routines import dumps, loads, dump, parse, dumps_object, loads_object, \
-    switch_default_float, switch_default_double
-from .exceptions import MiniJSONError, DecodingError, EncodingError
diff --git a/minijson/exceptions.pyx b/minijson/exceptions.pyx
deleted file mode 100644
index 19ccbe7..0000000
--- a/minijson/exceptions.pyx
+++ /dev/null
@@ -1,14 +0,0 @@
-class MiniJSONError(ValueError):
-    """
-    Base class for MiniJSON errors.
-
-    Note that it inherits from :code:`ValueError`.
-    """
-
-
-class EncodingError(MiniJSONError):
-    """Error during encoding"""
-
-
-class DecodingError(MiniJSONError):
-    """Error during decoding"""
diff --git a/minijson/routines.pxd b/minijson/routines.pxd
deleted file mode 100644
index ceeb54f..0000000
--- a/minijson/routines.pxd
+++ /dev/null
@@ -1,11 +0,0 @@
-import io
-
-cpdef object loads(bytes data)
-cpdef int dump(object data, cio: io.BytesIO) except -1
-cpdef bytes dumps(object data)
-cpdef tuple parse(bytes data, int starting_position)
-cpdef void switch_default_float()
-cpdef void switch_default_double()
-
-cpdef bytes dumps_object(object data)
-cpdef object loads_object(bytes data, object obj_class)
diff --git a/requirements.txt b/requirements.txt
index 8223c1e..002d1b9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1 @@
-snakehouse
 Cython
-satella
diff --git a/setup.py b/setup.py
index 51baa21..746a336 100644
--- a/setup.py
+++ b/setup.py
@@ -1,34 +1,25 @@
 import os
-from setuptools import find_packages
 from distutils.core import setup
-from snakehouse import Multibuild, build, monkey_patch_parallel_compilation, find_pyx
+from distutils.extension import Extension
 
-monkey_patch_parallel_compilation()
+from Cython.Build import cythonize
+from Cython.Compiler.Options import get_directive_defaults
 
-build_kwargs = {}
-directives = {'language_level': '3'}
-dont_snakehouse = False
-multi_kwargs = {}
+
+directive_defaults = get_directive_defaults()
+directive_defaults['language_level'] = '3'
+macros = []
 if 'DEBUG' in os.environ:
     print('Enabling debug mode')
-    dont_snakehouse = True
-    build_kwargs.update(gdb_debug=True)
-    directives.update(embedsignature=True,
-                      profile=True,
-                      linetrace=True,
-                      binding=True)
-    multi_kwargs['define_macros'] = [('CYTHON_TRACE', '1'),
-                                     ('CYTHON_TRACE_NOGIL', '1')]
-
-    import Cython.Compiler.Options
-    Cython.Compiler.Options.annotate = True
+    directive_defaults['linetrace'] = True
+    directive_defaults['binding'] = True
+    macros = [('CYTHON_TRACE', '1')]
 
+extensions = [Extension("minijson", ["minijson.pyx"],
+    define_macros=macros),
+]
 
 setup(version='1.7',
-      packages=find_packages(include=['minijson', 'minijson.*']),
-      ext_modules=build([Multibuild('minijson', find_pyx('minijson'),
-                                    dont_snakehouse=dont_snakehouse,
-                                    **multi_kwargs), ],
-                        compiler_directives=directives, **build_kwargs),
+      ext_modules=cythonize(extensions),
       python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*',
       )
-- 
GitLab