Re: Postgres Windows build system doesn't work with python installed in Program Files

David Zhang <david.zhang@highgo.ca>

From: David Zhang <david.zhang@highgo.ca>
To: Michael Paquier <michael@paquier.xyz>, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Cc: Ranier Vilela <ranier.vf@gmail.com>, Victor Wagner <vitus@wagner.pp.ru>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-06-02T00:05:50Z
Lists: pgsql-hackers
Hi Michael,

I performed a quick test for the path "msvc-build-init-v2.patch" using 
below cases:

1. perl build.pl
2. perl build.pl debug psql
3. perl build.pl RELEASE psql
4. perl build.pl deBUG psql
5. perl build.pl psql
The above cases (case-insensitive) are all working great without any 
warning for latest master branch.

When build with more than 3 parameters, yes, I got below expected 
message as well.

c:\Users\david\Downloads\postgres\src\tools\msvc>perl build.pl DEbug 
psql pg_baseback
Usage: build.pl [ [ <configuration> ] <component> ]
Options are case-insensitive.
configuration: Release | Debug. This sets the configuration
to build. Default is Release.
component: name of component to build. An empty value means
to build all components.


However, if I ask for help in a typical Windows' way, i.e, "perl 
build.pl -help" or "perl build.pl /?", I got some messages like below,

c:\Users\david\Downloads\postgres\src\tools\msvc>perl build.pl -help
Detected hardware platform: Win32
Files src/bin/pgbench/exprscan.l
Files src/bin/pgbench/exprparse.y
Files src/bin/psql/psqlscanslash.l
Files contrib/cube/cubescan.l
Files contrib/cube/cubeparse.y
Files contrib/seg/segscan.l
Files contrib/seg/segparse.y
Generating configuration headers...
Microsoft (R) Build Engine version 16.5.1+4616136f8 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1001: Unknown switch.
Switch: -help.vcxproj

For switch syntax, type "MSBuild -help"

c:\Users\david\Downloads\postgres\src\tools\msvc>perl build.pl /?
Detected hardware platform: Win32
Files src/bin/pgbench/exprscan.l
Files src/bin/pgbench/exprparse.y
Files src/bin/psql/psqlscanslash.l
Files contrib/cube/cubescan.l
Files contrib/cube/cubeparse.y
Files contrib/seg/segscan.l
Files contrib/seg/segparse.y
Generating configuration headers...
Microsoft (R) Build Engine version 16.5.1+4616136f8 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD : error MSB1001: Unknown switch.
Switch: /?.vcxproj

For switch syntax, type "MSBuild -help"

It would be a bonus if the build.pl can support the "help" in Windows' way.


Thanks,

David

On 2020-05-06 10:45 p.m., Michael Paquier wrote:
> On Wed, May 06, 2020 at 12:17:03AM +0200, Juan José Santamaría Flecha wrote:
>> Please forgive me if I am being too nitpicky, but I find the comments a
>> little too verbose, a usage format might be more visual and easier to
>> explain:
>>
>> Usage: build [[CONFIGURATION] COMPONENT]
>>
>> The options are  case-insensitive.
>> CONFIGURATION sets the configuration to build, "debug" or "release" (by
>> default).
>> COMPONENT defines a component to build. An empty option means all
>> components.
> Your comment makes sense to me.  What about the attached then?  On top
> of documenting the script usage in the code, let's trigger it if it
> gets called with more than 3 arguments.  What do you think?
>
> FWIW, I forgot to mention that I don't think those warnings are worth
> a backpatch.  No objections with improving things on HEAD of course.
> --
> Michael
-- 
David

Software Engineer
Highgo Software Inc. (Canada)
www.highgo.ca




Commits

  1. Improve perl script in MSVC to build binaries

  2. Handle spaces for Python install location in MSVC scripts

  3. Use perl's $/ more idiomatically