-
Notifications
You must be signed in to change notification settings - Fork 8
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
Handle additional path-based version specifiers #25
Handle additional path-based version specifiers #25
Conversation
1ab2b2e
to
057cbc7
Compare
pyarn/lockfile.py
Outdated
@@ -46,7 +46,7 @@ def __init__( | |||
self.version = version | |||
self.url = url | |||
self.checksum = checksum | |||
self.relpath = relpath | |||
self.path = path |
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.
Would it make sense to keep relpath as an alias to path for backward compatibility?
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.
That's a good point 👍
057cbc7
to
b982dd7
Compare
Apart from existing comments LGTM. |
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.
Mostly LGTM with two small suggestions.
self.dependencies = dependencies or {} | ||
self.alias = alias | ||
|
||
@property | ||
def relpath(self) -> Optional[str]: |
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.
Please add a note stating that this is deprecated and is left for backward compatibility only.
elif version_path.is_absolute() or version.startswith(("./", "../")): | ||
return str(version_path) | ||
else: | ||
return 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.
A minor, non-blocking suggestion: could you please add a short comment or a link to a doc about when this branch could be reached?
It is possible to have an absolute path as the version specifier in Yarn-generated package.json and yarn.lock files. This makes the Package.relpath field name slightly misleading. Add Package.path instead and retain Package.relpath only for backwards compatibility. This will make the naming more accurate for future commits. Signed-off-by: Taylor Madore <[email protected]>
These are all valid version specifiers for path-style packages in package.json/yarn.lock: ./some/relative/path ../some/relative/path file:some/relative/path file:../some/relative/path link:some/relative/path link:../some/relative/path\ /some/absolute/path Ensure that the Package class provides a path in each of these cases. Signed-off-by: Taylor Madore <[email protected]>
Signed-off-by: Taylor Madore <[email protected]>
b982dd7
to
deec552
Compare
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.
LGTM.
Add handling for more path-based version specifiers
These are all valid version specifiers for path-style packages in package.json/yarn.lock:
./some/relative/path
../some/relative/path
file:some/relative/path
file:../some/relative/path
link:some/relative/path
link:../some/relative/path
/some/absolute/path
Ensure that the Package class provides a path in each of these cases.