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

'use_variant_shortlinks' config entry ignore by rez-cp #1701

Open
garrett-wbpa opened this issue Mar 27, 2024 · 5 comments
Open

'use_variant_shortlinks' config entry ignore by rez-cp #1701

garrett-wbpa opened this issue Mar 27, 2024 · 5 comments

Comments

@garrett-wbpa
Copy link

Hello,

I've disabled variant shortlinks for my windows machine using a rez config json file. I went to rez-cp a package to my repository and noticed that rez-cp was still trying to create a _v shortlink folder. It fails due to permissions, but rez-cp continues on and copies the full variant folder anwyay.

Environment

  • OS Windows
  • Rez version 3.0.0
  • Rez python version 3.9.13

To Reproduce

  1. set 'use_variant_shortlinks=false' in a rez config file
  2. rez-cp a package into a repository and see that a shortlink folder is still created.

Expected behavior
I expect rez-cp to skip the shortlink creation when the config specifies to do so.

Actual behavior
A _v folder is created even though my config is disabling them.

@JeanChristopheMorinPerso
Copy link
Member

I've disabled variant shortlinks for my windows machine using a rez config json file

We don't support JSON config files. Is it a typo?

@garrett-wbpa
Copy link
Author

garrett-wbpa commented Mar 27, 2024

I definitely saved my file as .json, but I suspect it was loaded by PyYAML without me noticing. I've moved it to a .yaml.

This is the contents of the config file I was testing.

{
    "plugins": {
        "package_repository": {
            "filesystem": {
                "file_lock_type": "mkdir",
            }
        },
    },
    "use_variant_shortlinks":true,
    "use_pyside": true,
    "use_pyqt": false,
    "gui_threads": true
}

Edit: I confirmed that I can use a YAML loader to load this dict, even though it was user error on my part.

@JeanChristopheMorinPerso
Copy link
Member

Just to be sure that your config is loaded properly, would you mind giving me the result of rez-config use_variant_shortlinks please?

@garrett-wbpa
Copy link
Author

Good point. I've just now confirmed that rez-config use_variant_shortlinks returns False and re-run my repro steps with the same issue. Oddly, I get a string formatting error when trying to copy a package containing the symlinked short variants, but no issue when copying something simple like os.

REZ_CONFIG_FILE=/w/CREW/garrett.broussard/scripts/rez_config/rez_config_002.yaml rez-config use_variant_shortlinks
False
REZ_CONFIG_FILE=/w/CREW/garrett.broussard/scripts/rez_config/rez_config_002.yaml rez-cp --dest-path ~/wbpa/tmp/wbpa_001 --allow-empty pycue
Traceback (most recent call last):
  File "C:\Users\garrett\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\garrett\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\opt\rez\Scripts\rez\rez-cp.exe\__main__.py", line 7, in <module>
  File "c:\opt\rez\lib\site-packages\rez\cli\_entry_points.py", line 127, in run_rez_cp
    return run("cp")
  File "c:\opt\rez\lib\site-packages\rez\cli\_main.py", line 191, in run
    returncode = run_cmd()
  File "c:\opt\rez\lib\site-packages\rez\cli\_main.py", line 183, in run_cmd
    return func(opts, opts.parser, extra_arg_groups)
  File "c:\opt\rez\lib\site-packages\rez\cli\cp.py", line 156, in command
    result = copy_package(
  File "c:\opt\rez\lib\site-packages\rez\package_copy.py", line 202, in copy_package
    _copy_variant_payload(
  File "c:\opt\rez\lib\site-packages\rez\package_copy.py", line 249, in _copy_variant_payload
    "Cannot copy source variant %s - its root does not appear to "
TypeError: not enough arguments for format string

@JeanChristopheMorinPerso
Copy link
Member

Umm, that's an error in our code.

rez/src/rez/package_copy.py

Lines 244 to 247 in a13f7bb

raise PackageCopyError(
"Cannot copy source variant %s - its root does not appear to "
"be present on disk (%s)." % src_variant.uri, variant_root
)

If should be:

        raise PackageCopyError(
            "Cannot copy source variant %s - its root does not appear to "
            "be present on disk (%s)." % (src_variant.uri, variant_root)
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants