-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
check if a download is successfull before deciding not to try the nex… #609
Conversation
|
||
if local_index is not None: | ||
dist = dist or find(requirement, local_index) | ||
dist, mylocation = dist, mylocation if dist else find(requirement, local_index) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two consecutive spaces here
Can you supply a justification for this change? What behavior led you to make the change? How does the change improve the behavior? Are there any backward compatible considerations? |
mylocation = self.download(dist.location, tmpdir) | ||
if os.path.exists(mylocation): | ||
return dist, mylocation | ||
return None, None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The presence of None, None
is a bad smell to me. Better would be to return above a single value which wraps the necessary components, maybe a namedtuple('DistLocation', 'dist location')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe augment the resulting dist with a ._found_location
attribute or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I can clean this up,
thought this would be ok, since process_index
inner scan(link)
function already does the same ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. I acknowledge - there are some old and undesirable patterns in setuptools, given its 11 year history.
the problem this fixes for me is: when I specify
where server1 and server2 could e..g be a public github.com and a private github enterprise, I could see more cases where it would be beneficial to try a second location if it exists, if the first download fails. Since, we have a second location, why not? |
backwards compatibility: I don't believe a lot of work-flows would rely on the fact that an installation won't happen if the first tried link doesn't work, because this first tried link seems to be random. Depending on a few factors the first or second link will be tried first or last. This does check if the download path exists, so if downloaders are downloading something that does not result in an existing path this could break their behaviour, but what is a download if it doesn't result in a valid path? |
if local_index is not None: | ||
dist = dist or find(requirement, local_index) | ||
if not dist and local_index is not None: | ||
dist = find(requirement, local_index) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is not relevant to this pr, but this happens to be a nicer way to check, so it's in here.
old behaviour:
new behaviour:
|
Can you please add an entry to the changelog (0.1 bump) to describe to the users what they should expect from the change? |
72673f6
to
3856953
Compare
… check if downloads could succeed
3856953
to
87c7762
Compare
@jaraco added changes and rebased on top of master |
…t possible dist