Bug#1060026: yade: please move away from python3-future

Andreas Tille andreas at fam-tille.de
Thu Jan 25 06:17:13 GMT 2024


Hi Anton,

to avoid some race condition:  I'm just applying the patch and try
to build.  I'll let you know about success or failure.

Kind regards
    Andreas.

Am Wed, Jan 24, 2024 at 10:13:03PM +0100 schrieb Alexandre Detiste:
> control: tag -1 +patch
> 
> Hi,
> 
> Here's a patch.
> 
> I didn't try to be smart, just to get this done.
> 
> I have seen this package takes hours to build
> on buildd so I'm not even trying on my old fanless
> NUC knockoff.
> 
> Greetings

> diff --git a/core/main/main.py.in b/core/main/main.py.in
> index b8a52ca..11bc619 100644
> --- a/core/main/main.py.in
> +++ b/core/main/main.py.in
> @@ -2,8 +2,11 @@
>  # encoding: utf-8
>  # syntax:python
>  
> -from __future__ import print_function
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
>  
>  import sys,os,os.path,time
>  try:
> diff --git a/core/main/yade-batch.in b/core/main/yade-batch.in
> index 1d128ef..5b58cd6 100755
> --- a/core/main/yade-batch.in
> +++ b/core/main/yade-batch.in
> @@ -4,12 +4,6 @@
>  # vim: syntax=python
>  # portions © 2008 Václav Šmilauer <eudoxos at arcig.cz>
>  
> -from __future__ import print_function
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import os, sys, _thread, time, logging, pipes, socket, xmlrpc.client, re, shutil, random
>  
>  # Add search path for yade Python-modules
> diff --git a/core/main/yade-oar.in b/core/main/yade-oar.in
> index d96b60d..b8eb705 100644
> --- a/core/main/yade-oar.in
> +++ b/core/main/yade-oar.in
> @@ -7,12 +7,6 @@
>  # This script is to be used with OAR task scheduler. May be an example to use use with other task scheduler for clusters
>  # Adapted from yade-batch
>  
> -from __future__ import print_function
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import os, sys, _thread, time, logging, pipes, socket, xmlrpc.client, re, shutil, random
>  
>  # Add search path for yade Python-modules
> diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py
> index 001bc1a..548ed88 100644
> --- a/doc/sphinx/conf.py
> +++ b/doc/sphinx/conf.py
> @@ -21,11 +21,6 @@
>  ##
>  ## http://docutils.sourceforge.net/docs/howto/rst-roles.html
>  
> -from __future__ import print_function
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
>  import sys, os, re
>  from docutils import nodes
>  from sphinx import addnodes
> diff --git a/doc/sphinx/ipython_directive.py b/doc/sphinx/ipython_directive.py
> index 816d1bf..4cbcaee 100644
> --- a/doc/sphinx/ipython_directive.py
> +++ b/doc/sphinx/ipython_directive.py
> @@ -51,18 +51,11 @@ Authors
>  - Fernando Perez: refactoring, documentation, cleanups.
>  - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generatlizations.
>  """
> -from __future__ import print_function
> -
>  #-----------------------------------------------------------------------------
>  # Imports
>  #-----------------------------------------------------------------------------
>  
>  # Stdlib
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import io
>  import imp
>  import os
> diff --git a/doc/sphinx/ipython_directive012.py b/doc/sphinx/ipython_directive012.py
> index c98ecd4..14e7cce 100644
> --- a/doc/sphinx/ipython_directive012.py
> +++ b/doc/sphinx/ipython_directive012.py
> @@ -51,18 +51,11 @@ Authors
>  - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
>  - Skipper Seabold, refactoring, cleanups, pure python addition
>  """
> -from __future__ import print_function
> -
>  #-----------------------------------------------------------------------------
>  # Imports
>  #-----------------------------------------------------------------------------
>  
>  # Stdlib
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import io
>  import os
>  import re
> diff --git a/doc/sphinx/ipython_directive013.py b/doc/sphinx/ipython_directive013.py
> index c606acd..8f68221 100644
> --- a/doc/sphinx/ipython_directive013.py
> +++ b/doc/sphinx/ipython_directive013.py
> @@ -52,18 +52,11 @@ Authors
>  - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
>  - Skipper Seabold, refactoring, cleanups, pure python addition
>  """
> -from __future__ import print_function
> -
>  #-----------------------------------------------------------------------------
>  # Imports
>  #-----------------------------------------------------------------------------
>  
>  # Stdlib
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import io
>  import os
>  import re
> diff --git a/doc/sphinx/ipython_directive200.py b/doc/sphinx/ipython_directive200.py
> index 55ef14d..bca2cf7 100644
> --- a/doc/sphinx/ipython_directive200.py
> +++ b/doc/sphinx/ipython_directive200.py
> @@ -119,18 +119,11 @@ Authors
>  - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
>  - Skipper Seabold, refactoring, cleanups, pure python addition
>  """
> -from __future__ import print_function
> -
>  #-----------------------------------------------------------------------------
>  # Imports
>  #-----------------------------------------------------------------------------
>  
>  # Stdlib
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import os
>  import re
>  import sys
> diff --git a/doc/sphinx/ipython_directive500.py b/doc/sphinx/ipython_directive500.py
> index 94afab1..4a521fe 100644
> --- a/doc/sphinx/ipython_directive500.py
> +++ b/doc/sphinx/ipython_directive500.py
> @@ -119,18 +119,12 @@ Authors
>  - VáclavŠmilauer <eudoxos-AT-arcig.cz>: Prompt generalizations.
>  - Skipper Seabold, refactoring, cleanups, pure python addition
>  """
> -from __future__ import print_function
>  
>  #-----------------------------------------------------------------------------
>  # Imports
>  #-----------------------------------------------------------------------------
>  
>  # Stdlib
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import atexit
>  import os
>  import re
> diff --git a/doc/sphinx/tutorial/make-simulation-video.py b/doc/sphinx/tutorial/make-simulation-video.py
> index b4d9aaa..ec21c1f 100644
> --- a/doc/sphinx/tutorial/make-simulation-video.py
> +++ b/doc/sphinx/tutorial/make-simulation-video.py
> @@ -7,7 +7,12 @@
>  #
>  # plotting should be set up as usual
>  
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
> +
>  import matplotlib
>  matplotlib.use('Agg')  # headless backend, makes rendering plots after the simulation _much_ faster (and more reliable)
>  
> diff --git a/examples/capillaryLaplaceYoung/solveLaplace_uc.py b/examples/capillaryLaplaceYoung/solveLaplace_uc.py
> index 5bbd41e..b48acd6 100644
> --- a/examples/capillaryLaplaceYoung/solveLaplace_uc.py
> +++ b/examples/capillaryLaplaceYoung/solveLaplace_uc.py
> @@ -2,9 +2,12 @@
>  
>  # to import with yade/python/ipython solveLaplace_uc.py, or with execfile('solveLaplace_uc.py',globals()) once inside a yade/python/ipython session
>  
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
>  
> -from builtins import range
>  execfile('solveLiqBridge.py', globals())
>  
>  
> diff --git a/examples/concrete/periodic.py b/examples/concrete/periodic.py
> index 98df7c0..b4b3987 100644
> --- a/examples/concrete/periodic.py
> +++ b/examples/concrete/periodic.py
> @@ -1,9 +1,4 @@
>  # -*- encoding=utf-8 -*-
> -from __future__ import division
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
>  from yade import plot, pack
>  import time, sys, os, copy
>  """
> diff --git a/examples/concrete/uniax.py b/examples/concrete/uniax.py
> index 1f67524..7d12c4b 100644
> --- a/examples/concrete/uniax.py
> +++ b/examples/concrete/uniax.py
> @@ -1,9 +1,4 @@
>  # -*- encoding=utf-8 -*-
> -from __future__ import division
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
>  from yade import plot, pack, timing
>  import time, sys, os, copy
>  
> diff --git a/examples/deformableelem/main.py b/examples/deformableelem/main.py
> index 25a90b3..691d3d9 100644
> --- a/examples/deformableelem/main.py
> +++ b/examples/deformableelem/main.py
> @@ -21,7 +21,12 @@
>  #  MA 02110-1301, USA.
>  #
>  #
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
> +
>  import sys
>  
>  from yadeimport import *
> diff --git a/examples/jointedCohesiveFrictionalPM/gravityBis.py b/examples/jointedCohesiveFrictionalPM/gravityBis.py
> index 6445555..db421c1 100644
> --- a/examples/jointedCohesiveFrictionalPM/gravityBis.py
> +++ b/examples/jointedCohesiveFrictionalPM/gravityBis.py
> @@ -5,8 +5,12 @@
>  
>  # definition of a predicate for use of randomDensePack() function
>  
> -from __future__ import print_function
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
> +
>  from yade import pack
>  dimModele = 10.0
>  pred = pack.inAlignedBox((0, 0, 0), (dimModele, dimModele, dimModele))
> diff --git a/examples/jointedCohesiveFrictionalPM/testingJoint.py b/examples/jointedCohesiveFrictionalPM/testingJoint.py
> index aa44867..f2e918c 100644
> --- a/examples/jointedCohesiveFrictionalPM/testingJoint.py
> +++ b/examples/jointedCohesiveFrictionalPM/testingJoint.py
> @@ -4,9 +4,12 @@
>  # jerome.duriez at 3sr-grenoble.fr
>  
>  # Mechanical properties of rock matrix and rock joint :
> -from __future__ import print_function
> -from past.builtins import execfile
>  
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
>  
>  def mat():
>  	return JCFpmMat(
> diff --git a/py/3rd-party/mtTkinter-0.4/mtTkinter.py b/py/3rd-party/mtTkinter-0.4/mtTkinter.py
> index 6cbcc87..772bd6b 100644
> --- a/py/3rd-party/mtTkinter-0.4/mtTkinter.py
> +++ b/py/3rd-party/mtTkinter-0.4/mtTkinter.py
> @@ -52,12 +52,6 @@ created.
>  
>  Author: Allen B. Taylor, a.b.taylor at gmail.com
>  '''
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import object
>  from tkinter import *
>  import threading
>  import queue
> diff --git a/py/__init__.py.in b/py/__init__.py.in
> index ff974d9..fd148fb 100644
> --- a/py/__init__.py.in
> +++ b/py/__init__.py.in
> @@ -11,10 +11,6 @@ It loads yade plugins and injects c++ class constructors to the __builtins__
>  (that might change in the future, though) namespace, making them available
>  everywhere.
>  """
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
>  import ctypes,sys,os
>  
>  if os.getenv('OMPI_COMM_WORLD_RANK')==None: #else decrease verbosity
> diff --git a/py/pack/pack.py b/py/pack/pack.py
> index ed80ab4..8200ae9 100644
> --- a/py/pack/pack.py
> +++ b/py/pack/pack.py
> @@ -14,13 +14,6 @@ For examples, see
>  * :ysrc:`examples/gts-horse/gts-horse.py`
>  * :ysrc:`examples/WireMatPM/wirepackings.py`
>  """
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
> -from builtins import map
> -
> -from builtins import range
>  import itertools, warnings
>  from numpy import arange
>  from math import sqrt
> diff --git a/py/plot.py b/py/plot.py
> index 6c74f68..d8c4694 100644
> --- a/py/plot.py
> +++ b/py/plot.py
> @@ -4,14 +4,7 @@
>  Module containing utility functions for plotting inside yade. See :ysrc:`examples/simple-scene/simple-scene-plot.py` or :ysrc:`examples/concrete/uniax.py` for example of usage.
>  
>  """
> -from __future__ import print_function
> -
>  ## all exported names
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  __all__ = [
>          'data', 'plots', 'labels', 'live', 'liveInterval', 'setLiveForceAlwaysUpdate', 'autozoom', 'plot', 'reset', 'resetData', 'splitData', 'reverseData',
>          'addData', 'addAutoData', 'saveGnuplot', 'saveDataTxt', 'savePlotSequence'
> diff --git a/py/remote.py b/py/remote.py
> index d645a23..4190abc 100644
> --- a/py/remote.py
> +++ b/py/remote.py
> @@ -5,12 +5,6 @@ Remote connections to yade: authenticated python command-line over telnet and an
>  
>  These classes are used internally in gui/py/PythonUI_rc.py and are not intended for direct use.
>  """
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import object
>  import socketserver, xmlrpc.client, socket
>  import sys, time, os, math
>  
> diff --git a/py/utils.py b/py/utils.py
> index c588852..40f9c86 100644
> --- a/py/utils.py
> +++ b/py/utils.py
> @@ -7,13 +7,6 @@
>  
>  Devs: please DO NOT ADD more functions here, it is getting too crowded!
>  """
> -from __future__ import print_function
> -
> -from future import standard_library
> -standard_library.install_aliases()
> -
> -from builtins import range
> -from builtins import object
>  import math, random, doctest, numpy
>  from yade import *
>  import yade.math
> diff --git a/scripts/checks-and-tests/checks/checkList.py b/scripts/checks-and-tests/checks/checkList.py
> index fa9152e..10e78a0 100644
> --- a/scripts/checks-and-tests/checks/checkList.py
> +++ b/scripts/checks-and-tests/checks/checkList.py
> @@ -1,7 +1,11 @@
>  # encoding: utf-8
>  # 2011 © Bruno Chareyre <bruno.chareyre at grenoble-inp.fr>
> -from __future__ import print_function
> -from past.builtins import execfile
> +def execfile(filename, myglobals=None, mylocals=None):
> +    with open(filename, "rb") as fin:
> +         source = fin.read()
> +    code = compile(source, filename, "exec")
> +    exec(code)
> +
>  import yade
>  import math
>  import os


-- 
http://fam-tille.de



More information about the debian-science-maintainers mailing list