Skip to content

[build-script] Use the build-script-impl from the swift repo that invoked build-script. #8439

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

Conversation

gottesmm
Copy link
Contributor

[build-script] Use the build-script-impl from the swift repo that invoked build-script.

In the past if one wanted to be able to develop using multiple swift repos, one
was often stymied by build-script always using build-script-impl from the swift
directory. This includes the case where one invokes the build-script from a
hypothetical directory called swift-2.

This is just a productivity enhancement.

@gottesmm
Copy link
Contributor Author

@swift-ci Please python lint

@gottesmm
Copy link
Contributor Author

@swift-ci Please smoke test and merge

@gottesmm
Copy link
Contributor Author

Looks like some stripped off the executable bit from python lint. I ran it locally and everything passed.

@gottesmm gottesmm force-pushed the build_script_infer_swift_repo_name branch from 5517bbf to 5f99cbf Compare March 30, 2017 21:32
…oked build-script.

In the past if one wanted to be able to develop using multiple swift repos, one
was often stymied by build-script always using build-script-impl from the swift
directory. This includes the case where one invokes the build-script from a
hypothetical directory called swift-2.
@gottesmm gottesmm force-pushed the build_script_infer_swift_repo_name branch from 5f99cbf to e3858d3 Compare March 30, 2017 21:33
@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

I fixed python lint in this commit.

@gottesmm
Copy link
Contributor Author

@swift-ci python lint

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

1 similar comment
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 51e6f92 into swiftlang:master Mar 30, 2017
@gottesmm gottesmm deleted the build_script_infer_swift_repo_name branch March 30, 2017 22:17
@hughbe
Copy link
Contributor

hughbe commented Mar 31, 2017

I'm slightly confused with this. This isn't the repo name, but actually the repo path for swift:

...
def _get_default_swift_repo_name():
    result = ""

    # Are we in a Swift checkout? Start from this file and check its parent
    # directories.
    #
    # $SWIFT_SOURCE_ROOT/$SWIFT_REPO_NAME/utils/SwiftBuildSupport.py
    (swift_path, parent_dirname) = os.path.split(os.path.dirname(__file__))
    if parent_dirname != "utils":
        return result
    if not os.path.exists(os.path.join(swift_path, 'CMakeLists.txt')):
        return result
    return swift_path


# Set SWIFT_REPO_NAME in your environment to control the name of the swift
# directory name that is used.
SWIFT_REPO_NAME = os.environ.get(
    "SWIFT_REPO_NAME", _get_default_swift_repo_name())
print(SWIFT_REPO_NAME)
...

C:\Users\hughb\Documents\GitHub\swift\swift

This looks like the actual folder path, rather than the actual name of the directory (I'd expect this to be swift)

@hughbe
Copy link
Contributor

hughbe commented Mar 31, 2017

This doesn't actually matter, though:

print(os.path.join('C:/Users', 'C:/Users/hugh'))

This just prints C:/Users/hugh, as it adjusts for relative paths

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.

3 participants