[pygobject] Remove autotools build system



commit 14b3a9f4ddff59bd3959a68b104969f9f5a72ae5
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Mon Mar 26 12:38:33 2018 +0200

    Remove autotools build system

 .gitlab-ci/test-docker.sh |  29 ++----
 MANIFEST.in               |  12 +--
 Makefile.am               | 165 --------------------------------
 autogen.sh                |  37 --------
 configure.ac              | 216 ------------------------------------------
 examples/Makefile.am      |   6 --
 gi/Makefile.am            | 176 ----------------------------------
 gi/overrides/Makefile.am  |  23 -----
 gi/repository/Makefile.am |  16 ----
 m4/introspection.m4       |  96 -------------------
 m4/python.m4              | 237 ----------------------------------------------
 pygtkcompat/Makefile.am   |  16 ----
 setup.py                  |  62 ++++++------
 tests/Makefile.am         | 215 -----------------------------------------
 14 files changed, 37 insertions(+), 1269 deletions(-)
---
diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh
index 0b8a5d7b..7cefec8a 100755
--- a/.gitlab-ci/test-docker.sh
+++ b/.gitlab-ci/test-docker.sh
@@ -4,21 +4,20 @@ set -e
 
 python --version
 
-# ccache setup
-mkdir -p _ccache
-export CCACHE_BASEDIR="$(pwd)"
-export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
 PYVER=$(python -c "import sys; sys.stdout.write(''.join(map(str, sys.version_info[:3])))")
 PYIMPL=$(python -c "import sys, platform; sys.stdout.write(platform.python_implementation())")
 SOURCE_DIR="$(pwd)"
-PY_PREFIX="$(python -c 'import sys; sys.stdout.write(sys.prefix)')"
 COV_DIR="${SOURCE_DIR}/coverage"
-export PKG_CONFIG_PATH="${PY_PREFIX}/lib/pkgconfig"
 export MALLOC_CHECK_=3
 export MALLOC_PERTURB_=$((${RANDOM} % 255 + 1))
 export G_SLICE="debug-blocks"
 export COVERAGE_FILE="${COV_DIR}/.coverage.${PYVER}"
 export CFLAGS="-coverage -ftest-coverage -fprofile-arcs"
+export CCACHE_BASEDIR="$(pwd)"
+export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
+
+mkdir -p "${CCACHE_DIR}"
+mkdir -p "${COV_DIR}"
 
 if [[ "${PYIMPL}" == "PyPy" ]]; then
     # https://bitbucket.org/pypy/pypy/issues/2776
@@ -34,22 +33,8 @@ if [[ "${PYIMPL}" == "PyPy" ]]; then
     exit 0;
 fi;
 
-mkdir -p "${COV_DIR}"
-rm -Rf /tmp/build
-mkdir /tmp/build
-cd /tmp/build
-
-# BUILD
-"${SOURCE_DIR}"/autogen.sh --with-python=python
-make -j8
-
-# TESTS
-xvfb-run -a make check
-
-# CODE QUALITY CHECKS
-make check.quality
-
-cd "${SOURCE_DIR}"
+# CODE QUALITY
+python -m flake8
 
 # DOCUMENTATION CHECKS
 if [[ "${PYENV_VERSION}" == "2.7.14" ]]; then
diff --git a/MANIFEST.in b/MANIFEST.in
index 5f383eb4..fab933a1 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,20 +1,14 @@
 include setup.cfg
 include pyproject.toml
-include *.am
-include autogen.sh
-include configure.ac
 include COPYING
 include *.in
-include m4/introspection.m4
-include m4/python.m4
 include NEWS
 include tools/pygi-convert.sh
 include pygobject.doap
 include README.rst
 include .gitlab-ci.yml
-recursive-include examples *.py *.am *.png *.css *.ui *.gif *.gresource *.jpg *.xml
-recursive-include gi *.am *.h
-recursive-include pygtkcompat *.am
-recursive-include tests *.py *.c *.h *.xml *.supp *.am
+recursive-include examples *.py *.png *.css *.ui *.gif *.gresource *.jpg *.xml
+recursive-include gi *.h
+recursive-include tests *.py *.c *.h *.xml *.supp
 recursive-include docs *.rst *.svg LICENSE *.ico *.png *.css *.py *.dia Makefile
 recursive-include .gitlab-ci *.sh *.rst *.py Dockerfile*
diff --git a/setup.py b/setup.py
index e894bbf6..399a94ce 100755
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,6 @@
 
 import io
 import os
-import re
 import sys
 import errno
 import subprocess
@@ -39,6 +38,13 @@ from distutils.sysconfig import get_python_lib, customize_compiler
 from distutils import dir_util, log
 
 
+PYGOBJECT_VERISON = "3.29.0"
+GLIB_VERSION_REQUIRED = "2.38.0"
+GI_VERSION_REQUIRED = "1.46.0"
+PYCAIRO_VERSION_REQUIRED = "1.11.1"
+LIBFFI_VERSION_REQUIRED = "3.0"
+
+
 def get_command_class(name):
     # Returns the right class for either distutils or setuptools
     return Distribution({}).get_command_class(name)
@@ -48,36 +54,25 @@ def get_pycairo_pkg_config_name():
     return "py3cairo" if sys.version_info[0] == 3 else "pycairo"
 
 
-def get_version_requirement(conf_dir, pkg_config_name):
+def get_version_requirement(pkg_config_name):
     """Given a pkg-config module name gets the minimum version required"""
 
-    if pkg_config_name in ["cairo", "cairo-gobject"]:
-        return "0"
-
-    mapping = {
-        "gobject-introspection-1.0": "introspection",
-        "glib-2.0": "glib",
-        "gio-2.0": "gio",
-        get_pycairo_pkg_config_name(): "pycairo",
-        "libffi": "libffi",
+    versions = {
+        "gobject-introspection-1.0": GI_VERSION_REQUIRED,
+        "glib-2.0": GLIB_VERSION_REQUIRED,
+        "gio-2.0": GLIB_VERSION_REQUIRED,
+        get_pycairo_pkg_config_name(): PYCAIRO_VERSION_REQUIRED,
+        "libffi": LIBFFI_VERSION_REQUIRED,
+        "cairo": "0",
+        "cairo-gobject": "0",
     }
-    assert pkg_config_name in mapping
 
-    configure_ac = os.path.join(conf_dir, "configure.ac")
-    with io.open(configure_ac, "r", encoding="utf-8") as h:
-        text = h.read()
-        conf_name = mapping[pkg_config_name]
-        res = re.findall(
-            r"%s_required_version,\s*([\d\.]+)\)" % conf_name, text)
-        assert len(res) == 1
-        return res[0]
+    return versions[pkg_config_name]
 
 
-def parse_versions(conf_dir):
-    configure_ac = os.path.join(conf_dir, "configure.ac")
-    with io.open(configure_ac, "r", encoding="utf-8") as h:
-        version = re.findall(r"pygobject_[^\s]+_version,\s*(\d+)\)", h.read())
-        assert len(version) == 3
+def get_versions():
+    version = PYGOBJECT_VERISON.split(".")
+    assert len(version) == 3
 
     versions = {
         "PYGOBJECT_MAJOR_VERSION": version[0],
@@ -90,10 +85,10 @@ def parse_versions(conf_dir):
 
 def parse_pkg_info(conf_dir):
     """Returns an email.message.Message instance containing the content
-    of the PKG-INFO file. The version info is parsed from configure.ac
+    of the PKG-INFO file.
     """
 
-    versions = parse_versions(conf_dir)
+    versions = get_versions()
 
     pkg_info = os.path.join(conf_dir, "PKG-INFO.in")
     with io.open(pkg_info, "r", encoding="utf-8") as h:
@@ -645,9 +640,8 @@ def get_pycairo_include_dir():
     Raises if pycairo isn't found or it's too old.
     """
 
-    script_dir = get_script_dir()
     pkg_config_name = get_pycairo_pkg_config_name()
-    min_version = get_version_requirement(script_dir, pkg_config_name)
+    min_version = get_version_requirement(pkg_config_name)
     min_version_info = tuple(int(p) for p in min_version.split("."))
 
     def check_path(include_dir):
@@ -741,8 +735,6 @@ def get_pycairo_include_dir():
 
 
 def add_ext_pkg_config_dep(ext, compiler_type, name):
-    script_dir = get_script_dir()
-
     msvc_libraries = {
         "glib-2.0": ["glib-2.0"],
         "gio-2.0": ["gio-2.0", "gobject-2.0", "glib-2.0"],
@@ -759,7 +751,7 @@ def add_ext_pkg_config_dep(ext, compiler_type, name):
         # assume that INCLUDE and LIB contains the right paths
         ext.libraries += fallback_libs
     else:
-        min_version = get_version_requirement(script_dir, name)
+        min_version = get_version_requirement(name)
         pkg_config_version_check(name, min_version)
         ext.include_dirs += pkg_config_parse("--cflags-only-I", name)
         ext.library_dirs += pkg_config_parse("--libs-only-L", name)
@@ -846,8 +838,8 @@ class build_ext(du_build_ext):
     def _write_config_h(self):
         script_dir = get_script_dir()
         target = os.path.join(script_dir, "config.h")
-        versions = parse_versions(script_dir)
-        content = """
+        versions = get_versions()
+        content = u"""
 /* Configuration header created by setup.py - do not edit */
 #ifndef _CONFIG_H
 #define _CONFIG_H 1
@@ -1050,7 +1042,7 @@ def main():
         },
         install_requires=[
             "pycairo>=%s" % get_version_requirement(
-                script_dir, get_pycairo_pkg_config_name()),
+                get_pycairo_pkg_config_name()),
         ],
         data_files=[
             ('include/pygobject-3.0', ['gi/pygobject.h']),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]