Skip to content

[bootstrap] Update bootstrap utility to be Python 3 compatible #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 14, 2016
Merged

[bootstrap] Update bootstrap utility to be Python 3 compatible #197

merged 1 commit into from
Mar 14, 2016

Conversation

RLovelett
Copy link
Contributor

  • Enforce a UTF-8 encoded string when reading Package.swift
  • Convert map to list in Python 3

Fixes SR-934

@@ -41,6 +41,7 @@ import shutil
import subprocess
import sys
import tempfile
import codecs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit-pick: Let's keep this list of imports in alphabetical order. How about putting this between import argparse and import errno?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem; pushed that change up.

* Enforce a UTF-8 encoded string when reading Package.swift
* Convert `map` to `list` in Python 3
ddunbar added a commit that referenced this pull request Mar 14, 2016
[bootstrap] Update bootstrap utility to be Python 3 compatible
@ddunbar ddunbar merged commit 01982b8 into swiftlang:master Mar 14, 2016
@RLovelett RLovelett deleted the SR-934-SwiftPM-bootstrap-utility branch March 14, 2016 16:07
@aciidgh
Copy link
Contributor

aciidgh commented Mar 15, 2016

I think this made Python 2 incompatible, is that intended? I am getting this error with default python 2.7.10

Traceback (most recent call last):
  File "Utilities/bootstrap", line 237, in <module>
    targets = parse_manifest()
  File "Utilities/bootstrap", line 198, in parse_manifest
    manifest_data = open(os.path.join(g_project_root, "Package.swift"), encoding='utf-8', errors='strict').read()
TypeError: 'errors' is an invalid keyword argument for this function

I was able to bootstrap using :
$ Python3 Utilities/bootstrap

@RLovelett
Copy link
Contributor Author

That certainly wasn't intended. I tested it on my Mac (which has Python 2.7.11) and on my Linux box (which has Python 3.5.1). Both are able to bootstrap just fine for me.

When I submitted the line it looked like

manifest_data = codecs.open(os.path.join(g_project_root, "Package.swift"), encoding='utf-8', errors='strict').read()

the line you show in that error message looks like

manifest_data = open(os.path.join(g_project_root, "Package.swift"), encoding='utf-8', errors='strict').read()

Note that the codecs. module is not referenced in your error output. Perhaps that is just the error output "cleaning" it up or something. Just incase can you make sure it says codecs. in your actual script?

@aciidgh
Copy link
Contributor

aciidgh commented Mar 15, 2016

not sure what happened, I deleted and re-fetched the master; codecs. seems to be back and its working now

@ddunbar
Copy link
Contributor

ddunbar commented Mar 15, 2016

If you see it again see if you can verify exactly what version of Python that is.

On Mar 14, 2016, at 5:58 PM, Ankit Agarwal [email protected] wrote:

not sure what happened, I deleted and re-fetched the master; codecs. seems to be back and its working now


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#197 (comment) #197 (comment)

@aciidgh
Copy link
Contributor

aciidgh commented Mar 15, 2016

I think it was some issue with git and maybe was related to 6008cef

@ddunbar
Copy link
Contributor

ddunbar commented Mar 15, 2016

Ah, yes that makes sense.

@mxcl
Copy link
Contributor

mxcl commented Mar 15, 2016

This was my bad, though not because of this commit, I merged another python PR manually as it was conflicting with this one and I merged it badly.

Then pushed a fix.

aciidgh pushed a commit to aciidgh/swift-package-manager that referenced this pull request Jan 11, 2019
[BuildSystem] Fix symlink output value if the output is ever missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants