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

feat: Add proper support for IBM i #140

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@ def GetFlavor(params):
return "aix"
if sys.platform.startswith(("os390", "zos")):
return "zos"
if sys.platform == "os400":
return "os400"

return "linux"

Expand All @@ -463,9 +465,13 @@ def CopyTool(flavor, out_path, generator_flags={}):
to |out_path|."""
# aix and solaris just need flock emulation. mac and win use more complicated
# support scripts.
prefix = {"aix": "flock", "solaris": "flock", "mac": "mac", "win": "win"}.get(
flavor, None
)
prefix = {
"aix": "flock",
"os400": "flock",
"solaris": "flock",
"mac": "mac",
"win": "win",
}.get(flavor, None)
if not prefix:
return

Expand Down
2 changes: 1 addition & 1 deletion pylib/gyp/flock_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def ExecFlock(self, lockfile, *cmd_list):
# with EBADF, that's why we use this F_SETLK
# hack instead.
fd = os.open(lockfile, os.O_WRONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
if sys.platform.startswith("aix"):
if sys.platform.startswith("aix") or sys.platform == "os400":
# Python on AIX is compiled with LARGEFILE support, which changes the
# struct size.
op = struct.pack("hhIllqq", fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
Expand Down
28 changes: 28 additions & 0 deletions pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,24 @@ def CalculateGeneratorInputInfo(params):
""" # noqa: E501


LINK_COMMANDS_OS400 = """\
quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)

quiet_cmd_alink_thin = AR($(TOOLSET)) $@
cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) -X64 crs $@ $(filter %.o,$^)

quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)

quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
""" # noqa: E501


LINK_COMMANDS_OS390 = """\
quiet_cmd_alink = AR($(TOOLSET)) $@
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
Expand Down Expand Up @@ -2351,6 +2369,16 @@ def CalculateMakefilePath(build_file, base_name):
"flock_index": 2,
}
)
elif flavor == "os400":
copy_archive_arguments = "-pPRf"
header_params.update(
{
"copy_archive_args": copy_archive_arguments,
"link_commands": LINK_COMMANDS_OS400,
"flock": "./gyp-flock-tool flock",
"flock_index": 2,
}
)

build_file, _, _ = gyp.common.ParseQualifiedTarget(target_list[0])
make_global_settings_array = data[build_file].get("make_global_settings", [])
Expand Down
1 change: 1 addition & 0 deletions test_gyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def main(argv=None):
else:
format_list = {
"aix5": ["make"],
"os400": ["make"],
"freebsd7": ["make"],
"freebsd8": ["make"],
"openbsd5": ["make"],
Expand Down