]> granicus.if.org Git - graphviz/commitdiff
remove support for Python 2
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 3 Jun 2021 00:20:18 +0000 (17:20 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 9 Jun 2021 01:26:02 +0000 (18:26 -0700)
Python 2 was EOLed in 2020. This change removes support for building Graphviz
bindings for Python 2, as well as build system detection of Python 2. The
targets for `python` as distinct from `python3` are left in place for
environments for which the former is their name for Python 3.

Closes #1992.

15 files changed:
.gitignore
CHANGELOG.md
ci/centos7/Dockerfile
ci/centos8/Dockerfile
ci/ubuntu-18.04/Dockerfile
ci/ubuntu-20.04/Dockerfile
ci/ubuntu-20.10/Dockerfile
ci/ubuntu-21.04/Dockerfile
configure.ac
debian/rules
redhat/graphviz.spec.fedora.in
tclpkg/Makefile.am
tclpkg/gv/Makefile.am
tclpkg/gv/demo/Makefile.am
tclpkg/gv/gv_doc_langs.tcl

index 4d1e19a69025b9334f59671d2f966dadf8959462..4748b8b3ac5dc049c444768efc168a5d1200f688 100644 (file)
@@ -132,7 +132,6 @@ tclpkg/gv/gv_ocaml.cpp
 tclpkg/gv/gv_perl.cpp
 tclpkg/gv/gv_php.cpp
 tclpkg/gv/gv_python.cpp
-tclpkg/gv/gv_python2.cpp
 tclpkg/gv/gv_python3.cpp
 tclpkg/gv/gv_ruby.cpp
 tclpkg/gv/gv_sharp.cpp
index 6774387815b53d564e496c3281f71d21231ac0fa..52ee21eef7c6295f0a2e3964b9bb4b4f9ccc0cbf 100644 (file)
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - implicit 63 character limit on plugin names is removed in GVC
 - the packaging work flow on CentOS 7 now selects the Python 3 bindings, instead
   of Python 2 bindings
+- remove Python 2 bindings #1992
 
 ### Fixed
 
index cba52c3a1a8388e5b3123fff60cc4d115ab6cf4f..e1d66d2edfbacaff86a8663cbe7095ae7a912452 100644 (file)
@@ -64,8 +64,6 @@ php-devel \
 bzip2-devel \
 openssl-devel \
 libxml2-devel \
-# Language extension gv_python & gv_python2
-python2-devel \
 # Language extension gv_python3
 python3-devel \
 # Language extension gv_ruby
index 9657dc87b18afb490403b39fcc205299b375afe5..ff48d2be08d8b85ace40950719528486bc3cd3a1 100644 (file)
@@ -54,8 +54,6 @@ perl-ExtUtils-Embed \
 php-devel \
 openssl-devel \
 libxml2-devel \
-# Language extension gv_python & gv_python2
-python2-devel \
 # Language extension gv_python3
 python3-devel \
 # Language extension gv_ruby
index 51b6bebc1b90c11185f18227b574ffe307c8a6df..b762f1f8d7e372cebaa01883fdb7b9d9886d2f75 100644 (file)
@@ -70,8 +70,6 @@ libperl-dev \
 php-dev \
 libsodium-dev \
 libargon2-0-dev \
-# Language extension gv_python & gv_python2
-python2.7-dev \
 # Language extension gv_python3
 libpython3-dev \
 # Language extension gv_ruby
index e80dc371b4a0dc4007614e63729dd7c56cc91180..956d8ebec00923b9b1420f8580d018d58867da33 100644 (file)
@@ -70,8 +70,6 @@ libperl-dev \
 php-dev \
 libsodium-dev \
 libargon2-0-dev \
-# Language extension gv_python & gv_python2
-python2.7-dev \
 # Language extension gv_python3
 libpython3-dev \
 # Language extension gv_ruby
index 497269704d5a84d015f9022d5e1602770d88f710..62554eb93b1b4572d7de80dff5aea29f4ead8d5d 100644 (file)
@@ -72,8 +72,6 @@ libperl-dev \
 php-dev \
 libsodium-dev \
 libargon2-0-dev \
-# Language extension gv_python & gv_python2
-python2.7-dev \
 # Language extension gv_python3
 libpython3-dev \
 # Language extension gv_ruby
index 962f8b327bab1a2c631ba55a60cf89d202d1778b..2393872a8329a8e336db7dbf42ca253a457b1904 100644 (file)
@@ -72,8 +72,6 @@ libperl-dev \
 php-dev \
 libsodium-dev \
 libargon2-0-dev \
-# Language extension gv_python & gv_python2
-python2.7-dev \
 # Language extension gv_python3
 libpython3-dev \
 # Language extension gv_ruby
index 29055cfcf56465156da331e9070ac6f2bb4bfe66..257386c4563a7ea755355872fc12455f9e934824 100644 (file)
@@ -1256,65 +1256,6 @@ else
 fi
 AM_CONDITIONAL(WITH_PYTHON, [test "x$use_python" = "xYes"])
 
-dnl -----------------------------------
-dnl INCLUDES and LIBS for PYTHON2
-
-AC_ARG_ENABLE(python2,
-  [AS_HELP_STRING([--enable-python2=yes],[python2 language bindings])],
-  [], [enable_python2=yes])
-
-if test "x$enable_python2" != "xyes"; then
-  use_python2="No (disabled)"
-else
-  if test "x$use_swig" != "xYes"; then
-    use_python2="No (swig not available)"
-  else
-    if test `$SWIG -help 2>&1 | $EGREP -c '\-python *- Generate'` = 0; then
-      use_python="No (swig does not support -python option)"
-    else
-      AC_CHECK_PROG(PYTHON2,python2,python2)
-      if test "x$PYTHON2" = "x"; then
-        use_python2="No (python2 not available)"
-      else
-        PYTHON2_VERSION=`$PYTHON2 -c "import sys; print('%d.%d' % sys.version_info[[0:2]])"`
-        if test "x$PYTHON2_VERSION" = "x"; then
-          PYTHON2=
-        else
-          PYTHON2_VERSION_MAJOR=`echo $PYTHON2_VERSION | cut -d '.' -f 1`
-          PYTHON2_VERSION_MINOR=`echo $PYTHON2_VERSION | cut -d '.' -f 2`
-          if test $PYTHON2_VERSION_MINOR -lt 3; then
-            PYTHON2=
-          fi
-        fi
-      fi
-      if test "x$PYTHON2" = "x"; then
-           use_python2="No (python2 is too old)"
-      else
-        if test "x$PKG_CONFIG" != "x"; then
-          AC_MSG_CHECKING(for Python2 headers and libraries with pkg-config)
-          echo
-          pkgconfig_python2_found=`$PKG_CONFIG --exists python-$PYTHON2_VERSION 2>/dev/null`
-          if test "x$?" = "x0" ; then
-               PYTHON2_INCLUDES="$PYTHON2_CFLAGS "`$PKG_CONFIG --cflags python-$PYTHON2_VERSION`
-               PYTHON2_LIBS="$PYTHON2_LFLAGS "`$PKG_CONFIG --libs python-$PYTHON2_VERSION`
-          else
-                  use_python2="No (python-$PYTHON2_VERSION.pc not found)"
-                  PYTHON2=
-          fi
-        fi
-        PYTHON2_INSTALL_DIR="`$PYTHON2 $srcdir/config/config_python.py archsitelib`"
-       if test "x$PYTHON2" != "x"; then
-         use_python2="Yes"
-          AC_SUBST([PYTHON2_INSTALL_DIR])
-          AC_SUBST([PYTHON2_INCLUDES])
-          AC_SUBST([PYTHON2_LIBS])
-        fi
-      fi
-    fi
-  fi
-fi
-AM_CONDITIONAL(WITH_PYTHON2, [test "x$use_python2" = "xYes"])
-
 dnl -----------------------------------
 dnl INCLUDES and LIBS for PYTHON3
 
@@ -3146,7 +3087,6 @@ echo "  gv_ocaml:      $use_ocaml"
 echo "  gv_perl:       $use_perl"
 echo "  gv_php:        $use_php"
 echo "  gv_python:     $use_python"
-echo "  gv_python2:    $use_python2"
 echo "  gv_python3:    $use_python3"
 echo "  gv_R:          $use_r"
 echo "  gv_ruby:       $use_ruby"
index ded9a6d57889907cd9e6c1004090cae7a6fc5a9e..3124c02b504a07a11bd7c8e6fb94e365dfa19ecf 100755 (executable)
@@ -33,7 +33,7 @@ LUA_PACKAGE       = $(CURDIR)/debian/libgv-lua
 
 DEV_PACKAGE       = $(CURDIR)/debian/libgraphviz-dev
 
-PYTHON_VERSIONS   = $(shell python2 --version 2>&1 | sed 's/.* \(.*\)\..*/python\1/'; python3 --version 2>&1 | sed 's/.* \(.*\)\..*/python\1/')
+PYTHON_VERSIONS   = $(shell python3 --version 2>&1 | sed 's/.* \(.*\)\..*/python\1/')
 PYTHON_PACKAGE    = $(CURDIR)/debian/libgv-python
 
 RUBY_VERSION      = 1.8
@@ -259,7 +259,6 @@ binary-arch: build install
        dh_installman -a
        dh_installchangelogs CHANGELOG.md -a
        dh_perl -a
-       dh_python2 -a
        dh_link -a
        dh_strip -a
        dh_compress -a
index 685efe864e5ecd854d24230db5071f90223e06e8..f9010da94c078aa7135e2448f87412af55b34e6b 100644 (file)
@@ -32,7 +32,6 @@ Source0: https://gitlab.com/graphviz/graphviz/-/archive/@VERSION@/graphviz-@VERS
 %global LASI       1
 %global OCAML      1
 %global WEBP       1
-%global PYTHON2    1
 %global PYTHON3    1
 %global QT5        1
 # Not yet.
@@ -107,9 +106,6 @@ BuildRequires: lasi-devel
 %if %{OCAML}
 BuildRequires: ocaml
 %endif
-%if %{PYTHON2}
-BuildRequires: python2 python2-devel
-%endif
 %if %{PYTHON3}
 BuildRequires: python3 python3-devel
 %endif
@@ -750,27 +746,6 @@ PHP extension for graphviz.
 %exclude %{_libdir}/graphviz/php/*.so
 %exclude %{_libdir}/graphviz/php/*.php
 
-#-- graphviz-lang-python2 rpm -------------------------------------------
-%if %{PYTHON2}
-%package lang-python2
-Group:          Applications/Multimedia
-Summary:        Python extension for graphviz
-Requires:       %{name} = %{version}-%{release}, python2
-Conflicts:      %{name}-python <= 2.41
-Conflicts:      %{name}-lang-python <= 2.41
-
-%description lang-python2
-Python extension for graphviz.
-
-%files lang-python2
-%defattr(-,root,root,-)
-%{_libdir}/python2*/*
-%{_datadir}/graphviz/demo/*.py*
-%{_mandir}/man3/gv.3python.*
-%exclude %{_libdir}/graphviz/python2/*.so
-%exclude %{_libdir}/graphviz/python2/*.py*
-%endif
-
 #-- graphviz-lang-python3 rpm -------------------------------------------
 %if %{PYTHON3}
 %package lang-python3
@@ -964,9 +939,6 @@ CFLAGS="$RPM_OPT_FLAGS" \
         --without-ann \
 %endif
         --disable-python \
-%if ! %{PYTHON2}
-        --disable-python2 \
-%endif
 %if ! %{PYTHON3}
         --disable-python3 \
 %endif
index d03cc5b38caa3d665bef5ce5af524bb9a8b324cb..f899f178d2e83262912fba9abfa749a224ebf2a0 100644 (file)
@@ -10,7 +10,6 @@ pkgocamldir = $(pkglibdir)/ocaml
 pkgperldir = $(pkglibdir)/perl
 pkgphpdir = $(pkglibdir)/php
 pkgpythondir = $(pkglibdir)/python
-pkgpython2dir = $(pkglibdir)/python2
 pkgpython3dir = $(pkglibdir)/python3
 pkgRdir = $(pkglibdir)/R
 pkgrubydir = $(pkglibdir)/ruby
@@ -83,17 +82,6 @@ if WITH_PYTHON
                echo "Skipping system installation of python binding."; \
        fi
 endif
-if WITH_PYTHON2
-       -mkdir -p $(DESTDIR)@PYTHON2_INSTALL_DIR@;
-       if test -w $(DESTDIR)@PYTHON2_INSTALL_DIR@; then \
-               (cd $(DESTDIR)@PYTHON2_INSTALL_DIR@; \
-                       cp -f $(DESTDIR)$(pkgpython2dir)/libgv_python2.so _gv.so; \
-                       cp -f $(DESTDIR)$(pkgpython2dir)/gv.py gv.py;) \
-       else \
-               echo "Warning: @PYTHON2_INSTALL_DIR@ is not writable."; \
-               echo "Skipping system installation of python2 binding."; \
-       fi
-endif
 if WITH_PYTHON3
        -mkdir -p $(DESTDIR)@PYTHON3_INSTALL_DIR@;
        if test -w $(DESTDIR)@PYTHON3_INSTALL_DIR@; then \
@@ -143,8 +131,6 @@ uninstall-hook:
        -rm -rf $(DESTDIR)@PHP_INSTALL_DIR@/gv.so $(DESTDIR)@PHP_INSTALL_DATADIR@/gv.php;
        -rm -rf $(DESTDIR)$(pkgpythondir);
        -rm -rf $(DESTDIR)@PYTHON_INSTALL_DIR@/_gv.so $(DESTDIR)@PYTHON_INSTALL_DIR@/gv.py;
-       -rm -rf $(DESTDIR)$(pkgpython2dir);
-       -rm -rf $(DESTDIR)@PYTHON2_INSTALL_DIR@/_gv.so $(DESTDIR)@PYTHON2_INSTALL_DIR@/gv.py;
        -rm -rf $(DESTDIR)$(pkgpython3dir);
        -rm -rf $(DESTDIR)@PYTHON3_INSTALL_DIR@/_gv.so $(DESTDIR)@PYTHON3_INSTALL_DIR@/gv.py;
        -rm -rf $(DESTDIR)$(pkgpython23dir);
index 8941c2220fa405025c9ea144dc1a6b3c9c49d525..476b0fcfca3a5c7b1602875ca69d1367ea25d08c 100644 (file)
@@ -228,17 +228,6 @@ $(PYTHON_data): gv_python.cpp
 gv_python.cpp: gv.i
        $(SWIG) -c++ -python -o gv_python.cpp $(srcdir)/gv.i
 
-pkgpython2dir = $(pkglibdir)/python2
-PYTHON2_data = gv.py
-nodist_libgv_python2_la_SOURCES = gv_python2.cpp $(PYTHON2_data)
-libgv_python2_la_SOURCES = $(BASESOURCES) gv_dummy_init.c
-libgv_python2_la_LIBADD = $(BASELIBS) $(PYTHON2_LIBS)
-libgv_python2_la_LDFLAGS = -module -avoid-version
-libgv_python2_la_CPPFLAGS = $(BASECPPFLAGS) $(PYTHON2_INCLUDES)
-$(PYTHON2_data): gv_python2.cpp
-gv_python2.cpp: gv.i
-       $(SWIG) -c++ -python -o gv_python2.cpp $(srcdir)/gv.i
-
 pkgpython3dir = $(pkglibdir)/python3
 PYTHON3_data = gv.py
 nodist_libgv_python3_la_SOURCES = gv_python3.cpp $(PYTHON3_data)
@@ -387,11 +376,6 @@ pkgpython_DATA = $(PYTHON_data)
 pkgpython_LTLIBRARIES = libgv_python.la
 DEVTSTS += test_python
 endif
-if WITH_PYTHON2
-pkgpython2_DATA = $(PYTHON2_data)
-pkgpython2_LTLIBRARIES = libgv_python2.la
-DEVTSTS += test_python2
-endif
 if WITH_PYTHON3
 pkgpython3_DATA = $(PYTHON3_data)
 pkgpython3_LTLIBRARIES = libgv_python3.la
@@ -549,9 +533,6 @@ endif
 if WITH_PYTHON
        (cd $(DESTDIR)$(pkgpythondir); rm -f _gv.so; $(LN_S) libgv_python.so _gv.so;)
 endif
-if WITH_PYTHON2
-       (cd $(DESTDIR)$(pkgpython2dir); rm -f _gv.so; $(LN_S) libgv_python2.so _gv.so;)
-endif
 if WITH_PYTHON3
        (cd $(DESTDIR)$(pkgpython3dir); rm -f _gv.so; $(LN_S) libgv_python3.so _gv.so;)
 endif
@@ -642,13 +623,6 @@ test_python: libgv_python.la
                ln -fs ../$(srcdir)/*.gv ../$(srcdir)/*.py .; \
                PYTHONPATH=. $(PYTHON) test.py)
 
-.PHONY: test_python2
-test_python2: libgv_python2.la
-       -(mkdir -p test_python2; cd test_python2; \
-               ln -fs ../.libs/libgv_python2.so _gv.so; \
-               ln -fs ../$(srcdir)/*.gv ../$(srcdir)/*.py .; \
-               PYTHONPATH=. $(PYTHON2) test.py)
-
 .PHONY: test_python3
 test_python3: libgv_python3.la
        -(mkdir -p test_python3; cd test_python3; \
@@ -690,7 +664,6 @@ CLEANFILES = test_*/* pkgIndex.tcl \
        gv_perl.cpp $(PERL_data) \
        gv_php.cpp $(PHP_data) \
        gv_python.cpp $(PYTHON_data) gv.pyc \
-       gv_python2.cpp $(PYTHON2_data) gv.pyc \
        gv_python3.cpp $(PYTHON3_data) gv.pyc \
        gv_R.cpp $(R_data) \
        gv_ruby.cpp $(RUBY_data) \
index e541ebbf40da8b2d2854b297bb12a3701298b999..d33e74af499c4c798d044e11fd2b0e4f1df2674d 100644 (file)
@@ -9,7 +9,6 @@ demoocamldir = $(pkgdatadir)/demo
 demoperldir = $(pkgdatadir)/demo
 demophpdir = $(pkgdatadir)/demo
 demopythondir = $(pkgdatadir)/demo
-demopython2dir = $(pkgdatadir)/demo
 demopython3dir = $(pkgdatadir)/demo
 demoRdir = $(pkgdatadir)/demo
 demorubydir = $(pkgdatadir)/demo
@@ -42,9 +41,6 @@ endif
 if WITH_PYTHON
 demopython_SCRIPTS = modgraph.py
 endif
-if WITH_PYTHON2
-demopython2_SCRIPTS = modgraph.py
-endif
 if WITH_PYTHON3
 demopython3_SCRIPTS = modgraph.py
 endif
index 94ba8ded94febe88e5fa1b0654c4f743deeb63bb..c7a49fe25b15c49a80e296f8f9da439eb24c6962 100644 (file)
@@ -401,52 +401,6 @@ array set LANGS {
                USAGE {
                }
        }
-       python2 {
-               TYPES {
-                       {Agraph_t* g} graph_handle
-                       {Agraph_t* sg} subgraph_handle
-                       {Agnode_t* n} node_handle
-                       {Agnode_t* t} tail_node_handle
-                       {Agnode_t* h} head_node_handle
-                       {Agedge_t* e} edge_handle
-                       {Agsym_t* a} attr_handle
-                       {char* gne} type
-                       {char* name} name
-                       {char* tname} tail_name
-                       {char* hname} head_name
-                       {char* attr} attr_name
-                       {char* val} attr_value
-                       {const char* filename} filename
-                       {char* engine} engine
-                       {char* string} string
-                       {char** outdata} outdata
-                       {char* format} format
-                       {FILE* f} channel
-                       {void** data} data_handle
-                       Agraph_t* graph_handle
-                       Agnode_t* node_handle
-                       Agedge_t* edge_handle
-                       Agsym_t* attribute_handle
-                       char* string
-                       {const char*} string
-                       char** outdata
-                       FILE* channel
-                       bool bool
-                       int int
-                       void** data_handle
-                       void {}
-               }
-               SYNTAX {
-                       gv.  (  {, }   {);}
-               }
-               SYNOPSIS {
-                       {#!/usr/bin/python2}
-                       {import sys}
-                       {import gv}
-               }
-               USAGE {
-               }
-       }
        python3 {
                TYPES {
                        {Agraph_t* g} graph_handle