Repository navigation
feat: add optional preclean and postclean options #1245
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
Open
jylenhofdecat
wants to merge
15
commits into
actions:main
Choose a base branch
from
jylenhof:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b2cf62b
add first clean up work
jylenhof 4a23520
update with a test
jylenhofdecat bf9c5d8
wip
jylenhofdecat c7d4148
fix: reorganize post actions
SimonBriche 24edd63
chore: build package
SimonBriche 360b5a6
chore: clean unused dist
SimonBriche 5f9011e
add true
jylenhofdecat f5a6c01
fix return code if no package to clean
jylenhofdecat b84c202
chore: build
SimonBriche 24d38ec
test: fix tests
SimonBriche 8d89100
test: add clean-pip tests
SimonBriche 56af32d
test: post python tests
SimonBriche 8f93146
fix indentation
jylenhofdecat efb69ec
add small docs
jylenhofdecat 0c7b799
add fix
jylenhofdecat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: reorganize post actions
- Loading branch information
commit c7d4148a08bd88941741ffca3a9366f0e4a2974f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,6 +13,6 @@ export async function cleanPipPackages() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+13
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // uninstall all currently installed packages (if any) | |
| // Use a shell so we can pipe the output of pip freeze into xargs | |
| await exec('bash', [ | |
| '-c', | |
| 'test $(which python) != "/usr/bin/python" -a $(python -m pip freeze | wc -l) -gt 0 && python -m pip freeze | xargs python -m pip uninstall -y || true' | |
| ]); | |
| // Get list of installed pip packages | |
| let pipFreezeOutput = ''; | |
| await exec('python', ['-m', 'pip', 'freeze'], { | |
| listeners: { | |
| stdout: (data: Buffer) => { | |
| pipFreezeOutput += data.toString(); | |
| } | |
| } | |
| }); | |
| const packages = pipFreezeOutput | |
| .split('\n') | |
| .map(line => line.trim()) | |
| .filter(line => line.length > 0 && !line.startsWith('#')); | |
| if (packages.length > 0) { | |
| for (const pkg of packages) { | |
| // Only uninstall the package name (ignore version specifier) | |
| const pkgName = pkg.split('==')[0]; | |
| await exec('python', ['-m', 'pip', 'uninstall', '-y', pkgName]); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 bash one-liner is complex and difficult to read. Consider breaking this into multiple steps or commands for better maintainability. The logic combines multiple conditions and commands that would be clearer if separated.