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

Can't specify path in hl2sdk-manifests option #160

Open
Fighter19 opened this issue Feb 13, 2024 · 2 comments
Open

Can't specify path in hl2sdk-manifests option #160

Fighter19 opened this issue Feb 13, 2024 · 2 comments

Comments

@Fighter19
Copy link

While specifying an absolute path outside of the current working directory, the call to computeScriptPaths in context_manager.py,
will badly determine the location of the script and therefore concatenate an absolute path with another absolute path, leading to an error.

HL2SDKCS2=/very/long/path/on/hdd/data/Git/hl2sdk python ../configure.py -s cs2 --hl2sdk-manifests /very/long/path/on/hdd/data/Git/metamod-source/hl2sdk-manifests/
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/prep.py", line 156, in Configure
    if not cm.generate(options.generator):
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/context_manager.py", line 93, in generate
    self.parseBuildScripts()
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 50, in parseBuildScripts
    self.execContext(cx)
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 152, in execContext
    exec(code, scriptGlobals)
  File "/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/AMBuildScript", line 68, in <module>
    SdkHelpers = builder.Eval(os.path.join(hl2sdk_manifests, 'SdkHelpers.ambuild'), {
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context.py", line 115, in Eval
    return self.cm.evalScript(self, path, vars or {})
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 60, in evalScript
    obj = self.importScriptImpl(context, path, vars or {})
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 81, in importScriptImpl
    self.generator.addConfigureFile(parent, scriptPath)
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/amb2_gen.py", line 744, in addConfigureFile
    self.db.add_or_update_script(path)
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/database.py", line 826, in add_or_update_script
    stamp = os.path.getmtime(path)
  File "/usr/lib/python3.10/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/very/long/path/on/hdd/data/Git/metamod-source/hl2sdk-manifests/SdkHelpers.ambuild'

Furthermore it seems that this is also the case when trying to specify a relative path:

HL2SDKCS2=/very/long/path/on/hdd/data/Git/hl2sdk python ../configure.py -s cs2 --hl2sdk-manifests ../../hl2sdk-manifests/
Script File: ../../hl2sdk-manifests/SdkHelpers.ambuild
Source Path: /very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm
Both: /very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/../../hl2sdk-manifests/SdkHelpers.ambuild
Checking CC compiler (vendor test gcc)... ['clang', '-m32', 'test.c', '-o', 'test-c']
found clang version 14.0, x86
Checking CXX compiler (vendor test gcc)... ['clang++', '-m32', 'test.cpp', '-o', 'test-cxx']
found clang version 14.0, x86
Checking CC compiler (vendor test gcc)... ['clang', '-m64', 'test.c', '-o', 'test-c']
found clang version 14.0, x86_64
Checking CXX compiler (vendor test gcc)... ['clang++', '-m64', 'test.cpp', '-o', 'test-cxx']
found clang version 14.0, x86_64
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/prep.py", line 156, in Configure
    if not cm.generate(options.generator):
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/context_manager.py", line 93, in generate
    self.parseBuildScripts()
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 50, in parseBuildScripts
    self.execContext(cx)
  File "/home/user/.local/lib/python3.10/site-packages/ambuild2/frontend/v2_2/context_manager.py", line 152, in execContext
    exec(code, scriptGlobals)
  File "/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/AMBuildScript", line 305, in <module>
    MMSPlugin.detectSDKs()
  File "/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/AMBuildScript", line 123, in detectSDKs
    SdkHelpers.findSdks(builder, self.all_targets, sdk_list)
  File "/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/../../hl2sdk-manifests/SdkHelpers.ambuild", line 23, in findSdks
    for sdk_name, sdk in SdkHelpers.getSdks(builder):
  File "/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/../../hl2sdk-manifests/SdkHelpers.ambuild", line 126, in getSdks
    for sdk_manifest in os.listdir(sdk_manifest_dir):
FileNotFoundError: [Errno 2] No such file or directory: '/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/hl2sdk-manifests/manifests'
Configure failed: [Errno 2] No such file or directory: '/very/long/path/on/hdd/data/Git/metamod-source/samples/s2_sample_mm/hl2sdk-manifests/manifests'
@psychonic
Copy link
Member

While it sounds like there's a potential issue here with AMBuild's path handling, the specific problem mentioned has now been addressed within SdkHelpers by automatically converting to correct absolute paths within there.

@psychonic
Copy link
Member

I believe that the remaining issue here is addressed by #170

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

No branches or pull requests

2 participants