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

fix: ignore pip install .whl file #142

Merged
merged 4 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/content/registry/python.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ const handleArgument = (argument, restCommandWords) => {

const baseCommandMatch = (line) => line.match(/pip3? +install/);
const packageWordParse = (word) => {
if (word.endsWith('.whl')) {
console.debug('Ignoring package with ".whl":', word);
return null;
}

const match = word.match(packageArea);
if (!match) return null;

Expand Down
1 change: 1 addition & 0 deletions src/content/registry/python.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe(parseCommand.name, () => {
'install numpy‑1.9.2+mkl‑cp34‑none‑win_amd64.whl',
'install MySQL_python==', // Although this is a valid package name, it's not a valid command
'install -r requirements.txt',
'install scipy-0.16.1-cp27-none-win_amd64.whl',
];
const createCommand = (packageManager) => commands.map((command) => `${packageManager} ${command}`);

Expand Down
117 changes: 100 additions & 17 deletions tests/real-examples/real-examples-results.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/real-examples/real-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ links:
comment: pip3 install command
post: answer
registry: pypi
https://stackoverflow.com/a/33984261:
comment: should Ignore this .whl as a package
post: answer
registry: pypi

https://stackoverflow.com/a/27709931:
comment: go get standard library
Expand Down
Loading