Skip to content
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

build: allow running configure from any directory #17321

Merged
merged 1 commit into from
Dec 10, 2017

Conversation

gibfahn
Copy link
Member

@gibfahn gibfahn commented Nov 26, 2017

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build

@gibfahn gibfahn added build Issues and PRs related to build files or the CI. python PRs and issues that require attention from people who are familiar with Python. labels Nov 26, 2017
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to build files or the CI. label Nov 26, 2017
@jasnell
Copy link
Member

jasnell commented Nov 26, 2017

One thing: this should either chdir back to the original directory or should print a warning to the console that the directory was changed, just as a friendly heads up to the user.

Copy link
Member

@bnoordhuis bnoordhuis left a comment

Choose a reason for hiding this comment

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

@jasnell Not necessary, the pwd is a per-process property.

(That's coincidentally why cd is always a shell built-in, you can't implement it as a separate binary.)

@jasnell
Copy link
Member

jasnell commented Nov 26, 2017

heh... oh bah, that's right ;-) ...

@refack
Copy link
Contributor

refack commented Nov 27, 2017

@jasnell might have been thinking about batch files, or shell scripts.

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 27, 2017
configure Outdated
@@ -35,12 +35,15 @@ import subprocess
import shutil
import string

# If not run from node/, cd to that directory.
root_dir = os.path.dirname(os.path.abspath(__file__))
Copy link
Contributor

Choose a reason for hiding this comment

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

You're shifting from rel-path to abs for root_dir, it might have impact WRT spaces or unicode in the base path, and it's hard to test...

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point.

I tried it with spaces+UTF-8, and it works on macOS, could you maybe try something similar for windows?

~/wrk/诺 德/node

Copy link
Contributor

Choose a reason for hiding this comment

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

D:\code\node-u诺 德github-desktop$ vcbuild x64
Looking for Visual Studio 2017
Found MSVS version 15.0
"C:\bin\dev\python27\python.exe" configure  --dest-cpu=x64 --tag=
Traceback (most recent call last):
  File "configure", line 40, in <module>
    os.chdir(root_dir)
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'D:\\code\\node-u? ?github-desktop'
Failed to create vc project files.

With or without PYTHONIOENCODING=UTF-8

Copy link
Contributor

Choose a reason for hiding this comment

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

I've tried messing around with this, but didn't find the right incantation.

Copy link
Member Author

Choose a reason for hiding this comment

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

So that works with the relative path but not the absolute one? If so I guess we should go back to relative paths.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, this works:

root_dir = os.path.dirname(__file__)
root_dir and os.chdir(root_dir)

Copy link
Member Author

@gibfahn gibfahn Nov 28, 2017

Choose a reason for hiding this comment

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

That doesn't work for me unless you then unset root_dir. Pushed a commit with that change.

▶▶▶ node/configure                                                                                                                                                                              ~/wrk/com
Traceback (most recent call last):
  File "node/configure", line 49, in <module>
    from gyp.common import GetFlavor
ImportError: No module named gyp.common

@jasnell
Copy link
Member

jasnell commented Nov 27, 2017

might have been thinking about batch files, or shell scripts.

I was :)

@refack refack removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 28, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Nov 28, 2017

Okay, so AFAICT we don't need root_dir any more, so I've removed it. If you've already approved this PR please take another look, it's quite different now.

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

nice

@refack
Copy link
Contributor

refack commented Nov 28, 2017

we don't need root_dir any more, so I've removed it

That's a great proof that if we figure out path idiosyncrasies in configure we can keep them from affecting the downstream process.

configure Outdated
@@ -35,21 +35,24 @@ import subprocess
import shutil
import string

# If not run from node/, cd to that directory.
if os.path.dirname(__file__):
os.chdir(os.path.dirname(__file__))
Copy link
Member

Choose a reason for hiding this comment

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

You could write this as:

os.chdir(os.path.dirname(__file__) or '.')

Which might make it more obvious that os.path.dirname('configure') == ''.

Or maybe that's just me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like it, added.

@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 10, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Dec 10, 2017

PR-URL: nodejs#17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@gibfahn gibfahn merged commit b7ff3c0 into nodejs:master Dec 10, 2017
@gibfahn gibfahn deleted the configure-cd branch December 10, 2017 18:34
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@MylesBorins MylesBorins mentioned this pull request Dec 12, 2017
@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 13, 2017
gibfahn added a commit that referenced this pull request Dec 20, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
gibfahn added a commit that referenced this pull request Dec 20, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
gibfahn added a commit that referenced this pull request Dec 20, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@gibfahn gibfahn mentioned this pull request Dec 20, 2017
@MylesBorins MylesBorins mentioned this pull request Dec 20, 2017
gibfahn added a commit that referenced this pull request Dec 20, 2017
PR-URL: #17321
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
MylesBorins added a commit that referenced this pull request Jan 2, 2018
Notable Changes:

* build:
  - configure can now be run from any directory (Gibson Fahnestock)
    #17321

PR-URL: #17776
MylesBorins added a commit that referenced this pull request Jan 2, 2018
Notable Changes:

* build:
  - configure can now be run from any directory (Gibson Fahnestock)
    #17321

PR-URL: #17776
gibfahn added a commit that referenced this pull request Jan 2, 2018
PR-URL: #17774

Notable Changes:

* deps:
  * upgrade npm to 5.6.0 (Kat Marchán) [#17535](#17535)
* build:
  * configure can now be run from any directory (Gibson Fahnestock) [#17321](#17321)
gibfahn added a commit that referenced this pull request Jan 3, 2018
PR-URL: #17774

Notable Changes:

* deps:
  * upgrade npm to 5.6.0 (Kat Marchán) [#17535](#17535)
* build:
  * configure can now be run from any directory (Gibson Fahnestock) [#17321](#17321)
gibfahn added a commit that referenced this pull request Jan 3, 2018
PR-URL: #17774

Notable Changes:

* deps:
  * upgrade npm to 5.6.0 (Kat Marchán) [#17535](#17535)
* build:
  * configure can now be run from any directory (Gibson Fahnestock) [#17321](#17321)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. python PRs and issues that require attention from people who are familiar with Python.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants