Commit Graph

13 Commits

Author SHA1 Message Date
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
Ross Bayer
e793fcf052 [Build System: build-script] Moved SWIFT_SOURCE_ROOT, SWIFT_BUILD_ROOT and SWIFT_REPO_NAME along with other project path constants into a new build_swift.constants module. 2020-02-11 12:46:03 -08:00
Ross Bayer
a7d6cd8126 [Build System: build-script] Adds a new cache_utils module to build_swift which replaces the existing module from swift_build_support. 2020-01-30 23:06:14 -08:00
Ross Bayer
5852aea3e8 [Build System: build-script] Updated the presets module to simplify the API and improve testability. 2020-01-20 02:34:45 -08:00
Ross Bayer
7587c7c0ac [Build System: build-script] Re-structured the build_swift module tests to contain a build_swift directory.
Having the test directory match the module we are testing means we can have scripts in the top level of utils/build_swift which can also have tests. As part of this re-structure the test utilties have been simplified somewhat and all tests no longer use a custom TestCase, rather the standard one exposed by the unittest module.
2020-01-19 01:31:21 -08:00
Ross Bayer
0fdef59633 [Build System: build-script] Adopt the six compatibility library in the build_swift module. 2020-01-17 15:43:54 -08:00
Ross Bayer
525708e485 Merge pull request #29265 from Rostepher/remove-assert-not-raises
[NFC][Build System: build-script] Remove TestCase.assertNotRaises method.
2020-01-16 23:30:59 -08:00
Ross Bayer
f5c56f201c [Build System: build-script] Remove the dumb assertNotRaises test method which does less than nothing as it produces right-ward drift without any meaningful semantic benefit. 2020-01-16 21:43:36 -08:00
Ross Bayer
bb22690af0 [Build System: build-script] Moves the rest of the build-script-impl migration code from swift_build_support into build_swift. 2020-01-16 21:00:11 -08:00
Ross Bayer
ff60592ac3 [Build System: build-script] Re-organized the build_swift module to maintain a similar nested structure to swift_build_support and other Python scripting that already exists in the project. 2020-01-15 18:05:59 -08:00
Ross Bayer
4edb8d9baa [build-script] Presets Module (#14422)
* Implemented a presets module which includes a more robust and easy to understand parser. Moved the swift-sdks migration code to a new migration module and added testing for both the presets and migration modules. Also converted build-script to use the new presets parser.

* Switched the expansion algorithm to resolve mixins in-place (little known feature) and also changed the parser to skip all non-preset sections. Tests are included for these two behaviors.

* Re-worked the presets error hierarchy to have more descriptive and information packed exception classes. Also re-worked the PresetParser to catch duplicate preset declarations and duplicate options in a single preset. There's some special shim-code to handle the disconnect between the Python 2 ConfigParser module and the Python 3 update which adds DuplicateOptionError.
2018-02-26 11:26:22 -08:00
Ross Bayer
85abdcd62d Argparse "Overlay" Module (#12873)
* Implemented a wrapper module around the standard argparse package, exposing the same interface with some extras on top, including a new builder type with expressive DSL for constructing complex argument parsers.

* Fixed imports in build_swift/argparse/__init__.py to make flake8 happy.

* More re-formmating to meet the exacting standards of the python_lint script.

* Added doc-strings to all the modules in the build_swift argparse overlay.

* Implemented a new BoolType for the argparse module which handles boolean-like values and replaces the hard-coded boolean values in the _ToggleAction class.

* Fixed the mess of imports in the tests sub-package to favor relative imports, so now the unit-tests will actually run as expected. The README has also been updated with a better command for executing the unit-test suite.

* Updated the add_positional method on the ArgumentParser builder class to only take a single action or default to the store action.

* Cleaned up the set_defaults method.

* Added validation test to run the build_swift unit-tests.

* Updated validation-test for the build_swift unit-test suite to use %utils.

* Fixed hard-coded default values in the expected_options module used for generating argument parser tests.

* Updated the comment in the Python validation test to run the build_swift unit-tests.
2017-11-27 21:49:44 -08:00