-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(pip_setup): Run pip setup extract in the correct directory #8320
Conversation
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.
Isn't it easier to simply change cwd
and leave the rest as is?
Then, we need to use the absolute path of the extract.py. Is I've just tried but it didn't create a PR. The script seems to run though. 🤔
|
It's because it generates |
🤔 I think we should move to cache aproach like in #8083 so we write our python file to the cache folder and the extracted json to the repo cache folder (which will be deleted after repo processing). The json files can have the same relative paths for easier referencing. |
The extracted json is already in the repo cache. Added a commit to move extract.py to the cache folder, PTAL. |
# Inserting the parent directory of the target setup.py in Python import path: | ||
sys.path.append(dirname(realpath(sys.argv[-1]))) |
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.
It's not necessary because we are already running the script in the setup.py
's directory.
# This is setup.py which calls setuptools.setup | ||
load_source('_target_setup_', sys.argv[-1]) | ||
load_source('_target_setup_', basename(sys.argv[-1])) |
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.
We could also do this in extract.ts#49
.
@@ -105,7 +108,7 @@ describe(getName(__filename), () => { | |||
expect( | |||
await extractPackageFile( | |||
'raise Exception()', | |||
'/tmp/folders/foobar.py', | |||
'folders/foobar.py', |
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.
To prevent confusion; otherwise cwd
would be /tmp/github/some/repo/tmp/folders
.
export async function parseReport(packageFile: string): Promise<PythonSetup> { | ||
const data = await readLocalFile(join(dirname(packageFile), REPORT), 'utf8'); |
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.
Here we assume the report json file is next to the package file.
@hisener can you also test it against a real repo with |
Rebased and tested after adding a |
f09d802
to
d89a709
Compare
🎉 This PR is included in version 24.22.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Changes:
Changes pip setup extract script's working directory to "dirname" of
setup.py
.Context:
Fixes #8319.
Documentation (please check one with an [x])
How I've tested my work (please tick one)
I have verified these changes via:
I run it against
hisener/renovate-tests
, see hisener/renovate-tests#32. The hosted app closes the PR because it fails to extract (See the issue for the error message).