Re: scons-python3 bootstrap.py broken

Russel Winder <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.devel
Message-ID <[email protected]>
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
> [email protected]
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

_______________________________________________
Scons-dev mailing list
[email protected]
https://pairlist2.pair.net/mailman/listinfo/scons-dev
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAABCgAGBQJXDSR2AAoJENS91dLOzae4wQAP/ivWDJbY2lCQX8eAsGpOXOXK
M/iGRDQPqeUKruoSb3jirjFYmjtyEVlMOf31+6Udp2exGXo4oFJ8sOcyDCkiAA8g
FlLFgBeB85jq29MGp3t7WVM9XAay4SiI3xsjm2GENZ9LCQSNUdzwKiSj5iWrCkPj
+wrIE5udlEZM2dOGLG/dZIUM71cR6d0kiD5sBBLy+R1k/ZRStUT1vtVcunt1b89a
bx7izdNYOlYYI/OW3r2YipwhKiBvkd87srnWKrUXiG/L/XvhxhTvir/WLXED1dhr
LuCbmGDBwhnfHVEGgrTy6opF8NVX9rklZ6phUTgZt9ulcVOKeqdgO0FY6v57fCl6
/d7ZC1n3e+e4D/hKBySeFuBvd/kf2QDqOTicMj5sL4WPHlwjHbBcXoeGJOvR8m/e
wgN4Ty3tYIKRVID4O27wV9I8a1Lyb1+q7OQBqH1+stdSKejmruKFP5sMcBgNbUsW
PYyLes+8cLdaRF5HpY85eOCfdo5vswPQImriOwCbSfNhMFjPZY+Faq7B7tlZqLQ3
1e8Q8rNg/wkVtYSdf/jvXAD4nFFTSnGtQDGDFNqgjB3mwpJbwxKznGZBuEtErMVe
AjqVK4goPEGWuxEZPmScUyLuhnZZMNkQtR/G3Um+tuZeBnpikmZ5rfN/onhUcuLJ
4ifuIFv7YZM4Sd3JE2u+
=pc6N
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.