Commit Graph

71 Commits

Author SHA1 Message Date
Joe Groff
46213b2048 Merge pull request #82028 from Steelskin/fabrice/line-directive-stop-expanding-response-files
line-directive: Actually stop expanding response files
2025-06-06 12:52:00 -07:00
Fabrice de Gans
209984f110 line-directive: Actually stop expanding response files
The changes in #81996 fixed the response file format but failed to
actually make `line-directive` stop expanding the response files in the
compiler invocation. These changes fix that.
2025-06-05 12:02:24 -07:00
Fabrice de Gans
b6ba8e5e54 line-directive: Update outdated comment 2025-06-05 09:32:46 -07:00
Fabrice de Gans
810588b0c5 line-directive: Stop expanding response files
`line-directive` was expanding response files for the swiftc invocation,
which was causing issues on CI when the file list got too long. This
changes the script to stop expanding response files and pass them as-is
to the swiftc invocation instead. The format for the response files was
also incorrect, with each individual file being quoted, so this fixes
the CMake script generating those.
Finally, this changes `line-directive` to dump the command line on
failure.
2025-06-04 13:16:50 -07:00
Alexander Cyon
4a2942bb4e Fix typos in: cmake, tools, utils, unittests, validation-test
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 02:34:00 +03:00
YOCKOW
d10381557b [NFC] Python Lint: Fix E275(missing whitespace after keyword) issues. 2022-08-21 16:07:07 +09:00
Evan Wilde
486a6a3a17 line-directive decode utf8 charset
The line-directive was failing due to receiving non-ascii chars.
This patch sets the command to expect utf-8 encoded strings.
2022-04-26 11:59:09 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Daniel Duan
025079466a [utils] Remove Python 2
The library `six` provides compatibility between Python 2, and 3. It's no
longer necessary once we migrate of Python 2 completely.

Also remove any custom logic for Python 2 (the ones referenced by
a commentanyways).

https://bugs.swift.org/browse/SR-16025
2022-03-20 13:22:04 -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
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
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
68a5343273 Merge pull request #32109 from compnerd/behold-the-future
Python 2/3 compat: gyb, gyb_sourcekit_support, gyb_syntax_support, li…
2020-06-01 14:17:51 -07:00
Gwynne Raskind
2001f07e52 Python 2/3 compat: gyb, gyb_sourcekit_support, gyb_syntax_support, line-directive 2020-05-31 14:20:20 -07:00
Mike Ash
2a55b9d08f Fix python lint errors. 2020-05-30 14:04:32 -04:00
David Zarzycki
80f0e39e1a [line-directive] Escape literal '['
New versions of Python warn if the literal is not escaped. Specifically:

    "Support for nested sets and set operations in regular expressions as in
    Unicode Technical Standard #18 might be added in the future. This would
    change the syntax. To facilitate this future change a FutureWarning will
    be raised in ambiguous cases for the time being. That include sets
    starting with a literal '[' or containing literal character sequences
    '--', '&&', '~~', and '||'. To avoid a warning, escape them with a
    backslash. (Contributed by Serhiy Storchaka in bpo-30349.)"

https://docs.python.org/dev/whatsnew/3.7.html
2020-04-14 07:19:25 -04:00
Ross Bayer
c096e29967 [Python: flake8] Update the utils/python_lint.py script to fail with a non-zero exit code if flake8 and flake8-import-order are not installed. 2020-02-03 13:10:15 -08:00
Daniel Rodríguez Troitiño
b981afb29b [windows][test] Improve line-directive test for Windows.
The line directive test was using a command for one of the tests. The
command was being built as a string, instead of relaying on Python
multi-platform command building from arrays. Additionally the command
itself was being escaped with single quotes, which in Windows mean
nothing and were ending in the output of the command.

The changes switches the string building for an array, and leaves the
string building and escaping to Python. This should work in both
macOS, Linux and Windows.

This should fix the failing test in Azure.
2019-07-17 12:37:41 -07:00
Dave Abrahams
c4d76fdc5c Satisfy the python linter 2019-01-07 15:27:48 -08:00
Dave Abrahams
4433a9f89e [line-directive] Add usage and explanatory text 2019-01-04 17:59:04 -08:00
Jordan Rose
6cd780395b [CMake] Make GNU-style response files for long argument lists (#18958)
...i.e. an actual shell-like argument list, rather than a
semicolon-separated list (CMake's internal stringification mechanism
for lists). Apart from being a little easier to read, this also works
directly with the response file support in swiftc itself now (not
depending on utils/line-directive).

(It's still not /quite/ enough to expand on a command-line, though,
since that will escape the quotes. The 'sed' command can get around
that: $(sed "s/'//g" foo.txt).)
2018-10-23 19:45:56 -07:00
Dave Abrahams
b52cf92609 Merge pull request #8292 from hughbe/gyb-line-direcrtive-cleanup
Cleanup recent line-directive and gyb test fixes
2017-03-26 23:54:40 -07:00
Hugh Bellamy
abfca72357 Run python linting on the file if running doctests 2017-03-27 12:31:56 +07:00
Hugh Bellamy
da9035cbb4 Cleanup recent line-directive and gyb test fixes 2017-03-25 15:45:27 +07:00
Hugh Bellamy
fbb4756cd8 Python-lint line-directive 2017-03-21 14:14:15 +07:00
Hugh Bellamy
53d0fba6e1 Use print_function in line-directive 2017-03-21 11:21:37 +07:00
Hugh Bellamy
79cf3bf171 Add regression test for recent line-directive breakage (SR-4238 ) 2017-03-21 10:32:27 +07:00
Hugh Bellamy
f235a78385 Properly clean up after line-directive doctests now delete=False 2017-03-21 08:29:40 +07:00
Hugh Bellamy
e3604357ea Fix line-directive test failures on Windows 2017-03-21 08:29:40 +07:00
swift-ci
b7163a6434 Merge pull request #8197 from hughbe/replace-line-directive-win-newline 2017-03-20 01:42:13 -07:00
swift-ci
854243b1cb Merge pull request #8192 from hughbe/line-directive-doctests 2017-03-20 00:16:47 -07:00
Hugh Bellamy
ff02ffe0f2 Fix newline errors in line-directive doctests 2017-03-20 14:09:58 +07:00
Hugh Bellamy
a52e7fc8b2 Return error code running line-directive doctests 2017-03-20 13:56:28 +07:00
Hugh Bellamy
995a879967 Use python to invoke line-directive doctests 2017-03-20 13:27:45 +07:00
Dave Abrahams
ea3cb07f10 Revert "Fix line-directive print errors on different python versions" 2017-03-19 14:35:33 -07:00
Dave Abrahams
3ce018e8d1 Revert "Python lint line-directive"
This reverts commit ccb7882ba0, as it broke the
line-directive tool per https://bugs.swift.org/browse/SR-4238
2017-03-19 13:52:43 -07:00
Hugh Bellamy
b43d63dc16 Fix line-directive print errors on different python versions 2017-02-10 14:51:48 +07:00
Hugh Bellamy
ccb7882ba0 Python lint line-directive 2017-02-09 18:15:07 +07:00
Hugh Bellamy
3b4187fcbb Fix line-directive tool to work around Windows command line max limit 2017-01-26 09:34:55 +00:00
practicalswift
a9d6d8938c [gardening] Fix recently introduced typos 2017-01-22 20:40:45 +01:00
Hugh Bellamy
e22e28e6a0 Fix line-directive-tool not being able to invoke swiftc.exe on Windows 2017-01-14 21:45:34 +00:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Ryan Lovelett
aa990aad58 Support Python 3 in the line-directive
* Switched to the "function" format of `RaiseError`
* Switched to the "function" format of `print`
2016-10-29 09:45:36 -04:00
Dave Abrahams
ee20a0193d [utils/line-directive] add reverse mapping
This will be useful for tooling involving gyb files.
2016-09-25 17:09:37 -07:00
Dave Abrahams
e253016a8d [utils/line-directive] add tests
in preparation for refactoring.
2016-09-25 16:40:03 -07:00
Michael Gottesman
07b463ba3e [gardening] Fix some python lint errors so this change is python lint clean. 2016-08-01 15:11:09 -07:00
Dave Abrahams
3f9b6aef01 utils/line-directive: cover type checker errors
This causes errors to be reported in the source file for things
generated by gyb.
2016-07-21 15:36:55 -07:00
practicalswift
da24168735 [Python] Fix recently introduced PEP-8 regression 2016-03-12 20:50:08 +01:00
Chris Lattner
7cbd5d96c3 update line-directive for #sourceLocation. 2016-03-12 09:25:29 -08:00