Commit Graph

5282 Commits

Author SHA1 Message Date
tbkka
6187697a6c [Python3] Fix test failures in update_checkout (#33141)
Use correct relative import for Python 2&3

Remove unused variable

Fix import ordering per python_lint
2020-07-28 11:47:55 -07:00
tbkka
421ebd2788 [Python3] Fix "undefined symbol 'unicode'" from python_lint (#33146)
* [Python3] Fix "undefined symbol 'unicode'" from python_lint

This is a little tricky.

Python 2 "unicode" was renamed to "str" in Python 3.

For Python 2 compatibility, we need to use "unicode" in a couple
of places, but that's not defined on Python 3, which causes
python_lint errors (even if the reference is never actually executed).

To workaround this, when running in Python 3, define "unicode"
as a synonym for "str".  This defines the symbol (avoiding the
"undefined symbol" error from python lint) while preserving
the correct functionality on both Python 2 and Python 3.

When we drop Python 2 support (which we should do as soon as
possible), we can drop this workaround and globally replace
"unicode" with "str" to get the right Python 3-only functionality.
2020-07-28 11:47:25 -07:00
Saleem Abdulrasool
483f55bf90 Merge pull request #33156 from compnerd/swift-apis
build: remove tensorflow-swift-apis from the master branch
2020-07-28 11:04:10 -07:00
Saleem Abdulrasool
2bf0ee413f build: remove tensorflow-swift-apis from the master branch
Remove the ability to build this dependency.
2020-07-28 08:27:24 -07:00
fredriss
a1ae109783 Merge pull request #33133 from hyp/compiler-rt-sim-libs
[build-script] copy over the simulator libclang_rt.*.a libraries to a…
2020-07-27 21:56:51 -07:00
tbkka
d693ef017e Disable a hack that causes breakage on Python 3.8 (#33137)
Hacking sys.modules here was added unconditionally to fix an import problem on
Windows (with Python 2.7???).

This script works fine on Python 2.7 on macOS either with or without this hack.

This script breaks badly on Python 3.8 on macOS with this hack, so I've disabled
it here for all Python 3.
2020-07-27 16:28:50 -07:00
Suyash Srijan
7ee6319cdc [Parse] [Sema] Update confusables diagnostic to mention the character names as well (#33105)
* [Parser] Update 'Confusables.def' file to include confusable and base character names

* [Parser] Add a new utility method to return the names of the confusable and base characters for a given confusable codepoint

* [Parser] Update diagnostic for confusable character during lexing to mention confusable and base character names

* [Sema] If there is just a single confusable character, emit a tailored diagnostic that also mentions the character names

* [Diagnostics] Add new diagnostic messages to the localization file

* [Test] Update confusables test

* [Utils] Update unicode confusables txt file and update script to regenerate confusables def file

* [Parse] Regenerate 'Confusables.def' using updated script

* [Utils] Adjust generate_confusables script based on review feedback

Fix a mistake with name mapping. Updated header comment. Fix a couple of linting issues.

* [Parse] Regenerate 'Confusables.def' file once again after script changes

* [Parse] Add the newline after end of 'getConfusableAndBaseCodepointNames' method

* [Test] Update diagnostic message in 'Syntax/Parser/diags.swift'
2020-07-27 23:15:31 +01:00
Alex Lorenz
3320d236e7 [build-script] copy over the simulator libclang_rt.*.a libraries to allow clang to link with them
Clang's driver started linking with libclang_rt.<os>sim.a when building for simulator.

Swift's build need to adapt to this clang change, by ensuring that the libclang_rt.<os>sim.a libraries are created during the build
2020-07-27 13:07:21 -07:00
Meghana Gupta
c042638a37 Merge pull request #33098 from meg-gupta/updatestyle
Update code as per Apple Style Guide
2020-07-25 07:44:44 -07:00
nate-chandler
d634042216 Merge pull request #33075 from nate-chandler/update-checkout/fallback-to-checkout-revision
[Update Checkout] Fall back to revision if branch checkout fails.
2020-07-25 07:08:46 -07:00
Mishal Shah
e38a8bf4aa Merge pull request #33076 from apple/shahmishal/support-correct-simulator-arch
Only execute test for supported simulator plaforms
2020-07-24 14:48:02 -07:00
Meghana Gupta
b34791a0a0 Update code as per Apple Style Guide
whitelist -> allowlist
blacklist -> denylist
2020-07-24 11:37:15 -07:00
tbkka
3459fe8d3f [Python3] Make update-checkout work with Python 2 & 3 (#33081)
* Python3 compatibility for Benchmarks

Three issues addressed here:

1. Dependency on dictionary iteration order

 CharacterProperties.swift.gyb iterated a dictionary to produce its output.
 Changed this to a list of tuples to ensure the order is predictable.

2. Python3 `map` returns an iterator, not a list

 Changed a bunch of `map` calls to `list(map(...))` to ensure the result is a list

3. Python3 `int()` expects a string, won't accept a list of characters

 Added a concatenation step that is effectively a no-op on Python2

* Make update-checkout work with Python3

Python3 doesn't like to pickle local functions, so make the multiprocessing
initialization function be global.

Python3 multiprocessing also seems to require conditional execution of the
top-level code.  TBH, I'm not entirely sure why Python 2 didn't need this.

* Adjust whitespace per python-lint
2020-07-24 09:22:57 -07:00
Saleem Abdulrasool
efaa7f7867 Merge pull request #33079 from compnerd/integration
build: remove PythonKit integration
2020-07-24 07:42:47 -07:00
Nate Chandler
2ef8f1b90e [Update Checkout] Fall back to revision if branch checkout fails.
In workflows featuring git worktrees, it is common for the same branch
to be in use by multiple multiple checkouts.  For example, at the
moment, the "master" branches of swift-format, swift-tensorflow-apis,
and pythonkit (and the "release" branch of ninja) are indicated, in
update-checkout-config.json, by both "master" and "release/5.3".  If one
has a workflow featuring git worktrees, that means that when one runs
<<update_checkout --scheme master>> in one's mainline directory and
<<update_checkout --scheme release/5.3>> in one's release/5.3 directory,
the latter will encounter failures for each of those four projects
because the branch "master" will already be checked out in the mainline
directory's worktrees and so it cannot be checked out in the
release/5.3's directory's worktrees.  The error looks something like:

    /path/to/swift-container/release53/swift-format failed
    (ret=128): ['git', 'checkout', u'master']
    fatal: 'master' is already checked out at
    '/path/to/swift-container/mainline/swift-format'

    /path/to/swift-container/release53/tensorflow-swift-apis failed
    (ret=128): ['git', 'checkout', u'master']
    fatal: 'master' is already checked out at
    '/path/to/swift-container/mainline/tensorflow-swift-apis'

    /path/to/swift-container/release53/pythonkit failed (ret=128):
    ['git', 'checkout', u'master']
    fatal: 'master' is already checked out at
    '/path/to/swift-container/mainline/pythonkit'

    /path/to/swift-container/release53/ninja failed (ret=128):
    ['git', 'checkout', u'release']
    fatal: 'release' is already checked out at
    '/path/to/swift-container/mainline/ninja'

Here, that workflow is enabled.  If <<git checkout branch_name>> fails,
for one of the projects, update_checkout falls back to getting the SHA
for the indicated branch via <<git rev-parse branch_name>> and then
checking out the SHA directly.
2020-07-23 23:45:18 -07:00
Saleem Abdulrasool
9f0e0a6e2e build: remove PythonKit integration 2020-07-23 13:38:54 -07:00
Saleem Abdulrasool
d6ea573092 Merge pull request #33051 from compnerd/encoded
validation-test: make scale-test explicitly handle encoding
2020-07-23 13:12:39 -07:00
Mishal Shah
3dc8b38bbe Merge pull request #32922 from buttaface/prebuilt
[build] extend support for building with a prebuilt toolchain to the corelibs and llbuild
2020-07-23 12:29:33 -07:00
Mishal Shah
a43626639f Only execute test for supported simulator plaforms 2020-07-23 11:07:10 -07:00
Saleem Abdulrasool
deff87d4e8 validation-test: make scale-test explicitly handle encoding
During the Python 2 to Python 3 conversion, the difference in encoding
became apparent.  Explicitly handle the encoding by opening the file
with an explicit encoding.  This prevents falling back to the `C` locale
which will use ASCII for UTF-8 which fails.
2020-07-23 08:59:28 -07:00
Saleem Abdulrasool
bfd5207071 gyb: special case list for conversion
In order to deal with encoding conversions for Python 2 and Python 3,
the string had to be passed through CStringIO for Python 2.  On Python
3, the strings are unicode.
2020-07-21 18:13:53 -07:00
Saleem Abdulrasool
5eb40fb03c Merge pull request #32970 from compnerd/force-encoding
Use UTF-8 I/O encoding for Python 3
2020-07-21 11:23:35 -07:00
Saleem Abdulrasool
3d755b4a5d test: force line-directive to UTF-8
Treat the I/O data as UTF-8 rather than the system encoding, which can
fallback to `C`, treating unicode data as ASCII.  This improves the test
coverage on Linux with Python 3.
2020-07-20 22:23:38 -07:00
Saleem Abdulrasool
c6a5e01c20 gyb: force I/O in UTF-8
We would rely on the system encoding, which if unspecified would fall
back to `C` treating the encoding as ASCII.  This fails with unicode
data in Python3.  Thanks to @tbkka for the brilliant idea of forcing the
encoding when reading the file.  This improves the test pass rate on
Linux with Python 3.
2020-07-20 22:23:38 -07:00
Andrew Trick
4b6641f15f Merge pull request #32860 from buttaface/skip-build
[build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built
2020-07-20 20:43:18 -07:00
tbkka
a6aa7a5f3f Minor python3 lint fixes (#33009) 2020-07-20 17:09:42 -07:00
tbkka
868425be8a More Python3 lint fixes (#32967)
* More Python3 lint fixes

Some of the issues addressed include:
* Don't use `l` as a variable name (confusable with `1` or `I`)
* `print` statement does not exist in Py3, use `print` function instead
* Implicit tuple deconstruction in function args is no longer supported,
  use explicit splat `*` at the call site instead
* `xrange` does not exist in Py3, use `range` instead

* Better name per review feedback
2020-07-19 21:44:13 -07:00
Butta
c969814a11 [build] Fix --skip-build-llvm so that its minimal targets, like tblgen, are still built 2020-07-18 03:45:17 +05:30
tbkka
3181dd1e4c Fix a bunch of python lint errors (#32951)
* Fix a bunch of python lint errors

* adjust indentation
2020-07-17 14:30:21 -07:00
tbkka
6a255ec829 [Python3] Adjust relative import statements to use relative syntax so they work with Py2 and Py3 (#32937)
* Rework a couple of benchmarks to work with both Python2 and Python3

* Adjust relative import statements to use relative syntax

Importing files from "the same directory as this file" was
implicitly supported in Python2.7 but not Python3.  The
syntax here works for both.
2020-07-17 09:06:16 -07:00
Butta
32d341e244 [build] extend support for building with a prebuilt toolchain to the corelibs and llbuild 2020-07-17 14:35:15 +05:30
Brent Royal-Gordon
4394e92c3f Merge pull request #32700 from brentdax/magical-and-evolutionary
Revise #file changes from SE-0274
2020-07-17 01:57:23 -07:00
Nathan Hawes
90594eeaf3 [build-script-impl] Simplify libcxx build step
Fixes ninja: error: unknown target 'cxx-headers' on master-next after an
upstream llvm change.
2020-07-16 11:02:10 -07:00
Saleem Abdulrasool
657d3e3252 Merge pull request #32859 from compnerd/empirically-testing
validation: make test_shell Python3 friendly
2020-07-15 16:10:22 -07:00
Saleem Abdulrasool
b16c5c1689 Merge pull request #32857 from compnerd/more-boilerplate
validation: fix nosetest in gyb for Python 3
2020-07-15 16:09:50 -07:00
Saleem Abdulrasool
e9e05b5676 Merge pull request #32858 from compnerd/curved-lines
validation: make `line-directive` python 3.5 friendly
2020-07-15 15:09:14 -07:00
Saleem Abdulrasool
4586a6ae3b validation: make test_shell Python3 friendly
The custom `shell` module would coerce the byte-string representation
from `subprocess` into a text string representation in the happy path.
However, the same handling was not applied to the error case.  This
would result in a byte-string representation being returned in Python 3
rather than the text string.  Perform the conversion in both cases to
ensure that we can handle the strings without having to do the
conversion.
2020-07-14 21:54:48 +00:00
Saleem Abdulrasool
586f7ea4df validation: make scale-test Python 3 friendly
`zip` will return a generator in Python 3 rather than the zipped list.
This results in the Nelder-Mead Simplex to fail as it does not actually
perform the optimization of the data.  Explicitly convert the data to a
form which can be consumed.
2020-07-14 16:49:51 +00:00
Brent Royal-Gordon
0e569f5d9e Add support for #fileID
This temporarily breaks -enable-experimental-concise-pound-file.

fixup adding #fileID
2020-07-13 14:05:13 -07:00
Saleem Abdulrasool
37443a0ea1 validation: make line-directive python 3.5 friendly
`ModuleNotFoundError` was introduced in python 3.6 as a child of
`ImportError`.  However, some of the CI hosts use python 3.5.  Use
`ImportError` as the filter type to be compatible with earlier python
versions.
2020-07-13 20:55:05 +00:00
Saleem Abdulrasool
fedf81f544 validation: fix nosetest in gyb for Python 3
The file-like object's `write` method in Python 3 returns the number of
bytes that are written.  This was not previously checked and is not
particularly interesting.  Simply blackhole the bytes written, repairing
the test on Python 3.
2020-07-13 20:43:23 +00:00
Saleem Abdulrasool
b6caab8cb7 test: use the o octal specifier for python 3 compatibility
This adjusts the permissions to use the octal specifier explicitly.
2020-07-13 15:50:40 +00:00
Saleem Abdulrasool
b02924e107 Merge pull request #32827 from compnerd/fix-it-ralph
test: make `apply-fixit-edits` python3 friendly
2020-07-13 08:45:21 -07:00
Saleem Abdulrasool
bf5698f1f4 Merge pull request #32792 from compnerd/sprinting-to-the-end
test: make `remote-run` Python 3 friendly
2020-07-10 14:49:13 -07:00
Saleem Abdulrasool
de34713210 test: make apply-fixit-edits python3 friendly
`iteritems` was removed in Python 3, adjust for that.
2020-07-10 14:34:14 -07:00
Michael Gottesman
adec7551c1 Merge pull request #32756 from gottesmm/eager_specializer_fix
[ownership] Fix the eager specializer for ownership
2020-07-10 12:43:37 -07:00
Saleem Abdulrasool
7573a640ed Merge pull request #32798 from compnerd/separate-issues
test: partially undo changes to `PathSanitizingFileCheck`
2020-07-10 07:55:32 -07:00
Michael Gottesman
5e36ae1c7c [sil] Add a forwarding cast called unchecked_value_cast.
Today unchecked_bitwise_cast returns a value with ObjCUnowned ownership. This is
important to do since the instruction can truncate memory meaning we want to
treat it as a new object that must be copied before use.

This means that in OSSA we do not have a purely ossa forwarding unchecked
layout-compatible assuming cast. This role is filled by unchecked_value_cast.
2020-07-09 21:14:32 -07:00
Jonas Devlieghere
d1a54a5301 Merge pull request #32802 from vedantk/pass-sysroot
[build-script] Tie llvm, swift, and lldb to the same sysroot
2020-07-09 21:10:10 -07:00
Vedant Kumar
b77d68a9f3 [build-script] Tie llvm, swift, and lldb to the same sysroot
rdar://62895058
2020-07-09 17:10:17 -07:00