sync: Use options from the txt file#464
Conversation
Merge PR jazzband#464. * 'sync-use-opts-from-txt' of github.com:suutari-ai/prequ: sync: Use options from the txt file
Add entry about merged PR jazzband#464. Fixes #1
1589fb7 to
34836e8
Compare
|
(Catching up) |
8505e95 to
294b5fb
Compare
The requirements.txt file might have index or find-links options which affects finding of the installable packages. Parse those options from the txt file before doing the sync. Utilize the pip options parsing code from the compile command which is now moved to a separate file.
Make sure that sync command passes the options specified in the txt file to the issued "pip install" command.
294b5fb to
a2a94c9
Compare
|
Rebased and added some tests too. |
| for link in find_links or []: | ||
| for link in repository.finder.find_links or []: | ||
| install_flags.extend(['-f', link]) | ||
| if no_index: |
There was a problem hiding this comment.
With this change the no_index flag is inhibited. Is this wanted?
There was a problem hiding this comment.
The no_index flag is passed to the get_pip_options_and_pypi_repository call which then passes it along to the finder in the constructed repository. That'll make the repository.finder.index_urls to be empty if no_index is True. It'll also consider --no-index specified in the parsed txt file.
| if extra_index_url: | ||
| for extra_index in extra_index_url: | ||
| install_flags.extend(['--extra-index-url', extra_index]) | ||
| for (i, index_url) in enumerate(repository.finder.index_urls): |
There was a problem hiding this comment.
This is not quite the same intent. I see that you are reconstructing the parameter invocation based upon the index_urls, but that exposes too much of the implementation detail. I don't quite grasp why you are doing this.
There was a problem hiding this comment.
The point here is that the call to pip.req.parse_requirements above (line 56) will update the flags in the repository.finder (which is passed to it) according to the flags specified in the txt file. Therefore the repository.finder.index_urls will contain combination of command line options and txt file options and this is then used here to construct the options given to pip install.
There was a problem hiding this comment.
I don't understand what you mean by the "implementation detail", since there wasn't really any separation between implementation and interface here before my changes either. If implementation details should be hidden, then there should be a class like RequirementsFileParser which then could be used to parse the txt files and as a result would output the list of requirements and pip options from the parsed files. That would be nice improvement, but completely another issue.
Can you elaborate what do you mean by exposing the implementation detail here?
|
Superseded by #824. |
The requirements.txt file might have index or find-links options which
affects finding of the installable packages. Parse those options from
the txt file before doing the sync.
Utilize the pip options parsing code from the compile command which is
now moved to a separate file.