vapoursynth / vsrepo

A simple package repository for VapourSynth
MIT License
113 stars 29 forks source link

Allow updates without a git token #149

Closed theChaosCoder closed 3 years ago

theChaosCoder commented 3 years ago

I think the only place where the git token is really necessary is the "mass update" function, to ensure one does not get blocked by github.

It is an unnecessary obstacle for people who only want to contribute a small package fix/update.

For updating single packages this should be ok: python vsrupdate.py -p akarin update-local -o

Currently the token is always mandatory: python vsrupdate.py -p akarin update-local -o -g your-github-token

The fetch_url function already supports calls without a token: https://github.com/vapoursynth/vsrepo/blob/ca5d6049b43c1dd3dff0d2f8005382d1c7d10c37/vsrupdate.py#L93

And I think this is the only place where a check would be necessary theoretically: https://github.com/vapoursynth/vsrepo/blob/ca5d6049b43c1dd3dff0d2f8005382d1c7d10c37/vsrupdate.py#L234

myrsloik commented 3 years ago

Sure, make it an optional argument then.

myrsloik commented 3 years ago

Now -g is optional

theChaosCoder commented 3 years ago

Yeah but it is broken now :D Try python vsrupdate.py -p lsmas update-local -o

This line fixes it apifile = json.loads(fetch_url(get_git_api_url(pfile['github']), pfile['name'], token=args.git_token[0] if args.git_token else None)) What I don't like is that args.git_token is a list. haven't figured out yet what to change in argparse in order to get a single value.

myrsloik commented 3 years ago

Commit your fix then. I think the list thing is simply how the arg parsing works.

theChaosCoder commented 3 years ago

Done. I will investigate further. I think it should be possible to get a single value instead of a list.

theChaosCoder commented 3 years ago

Ok it seems you just need to remove nargs=1 and it is a single value then. nargs = always a list.