[Scons-dev] scons-python3 bootstrap.py broken

Russel Winder russel at winder.org.uk
Tue Apr 12 12:38:14 EDT 2016


The python3-port branch doesn't work with Python3 as yet. It used to,
but as part of getting the branch up to date with default some bits of
code got reverted to Python 2 code. 

If people could (in the short term) send pull requests on python3-port
branch of https://bitbucket.org/russel/scons__python3 to deal with
problems such as highlighted and solved in this thread, I will accept
them.

Once the python3-port branch is merged into default in the mainline
repository, pull requests should go to the mainline.

On Tue, 2016-04-12 at 11:00 -0400, Neal Becker wrote:
> Neal Becker wrote:
> 
> > 
> > Attempting to run via bootstrap.py:
> > 
> >  python3 ~/scons-py3/bootstrap.py
> > /home/nbecker/anaconda3/envs/py35/bin/python3 /home/nbecker/scons-
> > py3/bootstrap/src/script/scons.py
> > Import failed. Unable to find SCons files in:
> >   /home/nbecker/scons-py3/bootstrap/src/engine
> >   /home/nbecker/scons-py3/bootstrap/src/script/../engine
> >   /home/nbecker/scons-py3/bootstrap/src/script/scons-local-
> > __VERSION__
> >   /home/nbecker/scons-py3/bootstrap/src/script/scons-local
> >   /home/nbecker/anaconda3/envs/py35/lib/scons-__VERSION__
> >   /home/nbecker/anaconda3/envs/py35/lib/python3.5/site-
> > packages/scons-
> > __VERSION__
> >   /home/nbecker/anaconda3/envs/py35/lib/scons-__VERSION__
> >   /home/nbecker/anaconda3/envs/py35/lib/scons
> >   /home/nbecker/anaconda3/envs/py35/lib/python3.5/site-
> > packages/scons
> >   /home/nbecker/anaconda3/envs/py35/lib/scons
> > Traceback (most recent call last):
> >   File "/home/nbecker/scons-py3/bootstrap/src/script/scons.py",
> > line 190,
> >   in
> > <module>
> >     import SCons.Script
> >   File "/home/nbecker/scons-
> > py3/bootstrap/src/engine/SCons/Script/__init__.py", line 88, in
> > <module>
> >     from . import Main
> >   File
> >   "/home/nbecker/scons-
> > py3/bootstrap/src/engine/SCons/Script/Main.py",
> > line 370
> >     except OSError, e:
> >                   ^
> > SyntaxError: invalid syntax
> > 
> > Something is rewriting Main.py.  If I manually fix it, then re-run
> > bootstrap.py Main.py gets re-written with syntax errors.
> OK, I found it.  Needed to fix src/engine/SCons/Script/Main.py, and
> run 2to3 
> on it:
> 
> hg diff 
> diff -r 0741afd71a7a src/engine/SCons/Script/Main.py
> --- a/src/engine/SCons/Script/Main.py	Sat Aug 23 16:28:44 2014
> -0400
> +++ b/src/engine/SCons/Script/Main.py	Tue Apr 12 10:59:37 2016
> -0400
> @@ -13,6 +13,7 @@
>  # Would affect exec()'d site_init.py:
>  ## from __future__ import print_function
>  from SCons.compat.six import print_
> +import collections
>  
>  unsupported_python_version = (2, 3, 0)
>  deprecated_python_version = (2, 7, 0)
> @@ -113,7 +114,7 @@
>          self.interval = interval
>          self.overwrite = overwrite
>  
> -        if callable(obj):
> +        if isinstance(obj, collections.Callable):
>              self.func = obj
>          elif SCons.Util.is_List(obj):
>              self.func = self.spinner
> @@ -233,7 +234,7 @@
>                      self.exception_set()
>                  self.do_failed()
>              else:
> -                print("scons: Nothing to be done for `%s'." % t)
> +                print(("scons: Nothing to be done for `%s'." % t))
>                  SCons.Taskmaster.OutOfDateTask.executed(self)
>          else:
>              SCons.Taskmaster.OutOfDateTask.executed(self)
> @@ -367,13 +368,13 @@
>          for t in self._get_files_to_clean():
>              try:
>                  removed = t.remove()
> -            except OSError, e:
> +            except OSError as e:
>                  # An OSError may indicate something like a
> permissions
>                  # issue, an IOError would indicate something like
>                  # the file not existing.  In either case, print a
>                  # message and keep going to try to remove as many
>                  # targets aa possible.
> -                print(("scons: Could not remove '%s':" % str(t), 
> e.strerror)
> +                print(("scons: Could not remove '%s':" % str(t), 
> e.strerror))
>              else:
>                  if removed:
>                      display("Removed " + str(t))
> @@ -734,7 +735,7 @@
>                      modname = os.path.basename(pathname)[:-len(sfx)]
>                      site_m = {"__file__": pathname, "__name__":
> modname, 
> "__doc__": None}
>                      re_special = re.compile("__[^_]+__")
> -                    for k in m.__dict__.keys():
> +                    for k in list(m.__dict__.keys()):
>                          if not re_special.match(k):
>                              site_m[k] = m.__dict__[k]
>  
> @@ -1421,10 +1422,10 @@
>              else:
>                  ct = last_command_end - first_command_start
>          scons_time = total_time - sconscript_time - ct
> -        print("Total build time: %f seconds"%total_time)
> -        print("Total SConscript file execution time: %f 
> seconds"%sconscript_time)
> -        print("Total SCons execution time: %f seconds"%scons_time)
> -        print("Total command execution time: %f seconds"%ct)
> +        print(("Total build time: %f seconds"%total_time))
> +        print(("Total SConscript file execution time: %f 
> seconds"%sconscript_time))
> +        print(("Total SCons execution time: %f seconds"%scons_time))
> +        print(("Total command execution time: %f seconds"%ct))
>  
>      sys.exit(exit_status)
>  
> 
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20160412/adbafb29/attachment.pgp>


More information about the Scons-dev mailing list