-
Notifications
You must be signed in to change notification settings - Fork 451
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
add egg updater script which fixes pytest initialization issue #672
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c7e319a
add egg updater script
Niraj-Kamdar b8ceae2
revert cli.py
Niraj-Kamdar 6ff5e7c
update cli.py
Niraj-Kamdar 2d6fbf7
only update checker if develop env set
Niraj-Kamdar 46a1b5e
add IS_PRODUCTION function to check for production build
Niraj-Kamdar 01d731e
Update cve_bin_tool/cli.py
Niraj-Kamdar 57cbf0a
Exclude egg_updater in the distribution
Niraj-Kamdar bed40fb
update cli.py
Niraj-Kamdar 3632d45
Merge remote-tracking branch 'upstream/master' into egg
Niraj-Kamdar a68be10
move egg_updater inside the cve_bin_tool/
Niraj-Kamdar b02e788
black format
Niraj-Kamdar bb7adbd
include IS_DEVELOP script
Niraj-Kamdar 1ba9531
update cli.py
Niraj-Kamdar 06b09a1
remove importlib
Niraj-Kamdar 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
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import os | ||
import sys | ||
from io import StringIO | ||
|
||
from setuptools.dist import Distribution | ||
|
||
|
||
def IS_DEVELOP(): | ||
return any( | ||
list( | ||
map( | ||
os.path.isfile, | ||
list( | ||
map( | ||
lambda syspath: os.path.join(syspath, "cve-bin-tool.egg-link"), | ||
sys.path, | ||
) | ||
), | ||
) | ||
) | ||
) | ||
|
||
|
||
def update_egg(): | ||
with StringIO() as f: | ||
cwd = os.getcwd() | ||
os.chdir(os.path.join(os.path.dirname(__file__), "..")) | ||
sys.stdout = f | ||
dist = Distribution( | ||
dict( | ||
script_name="setup.py", | ||
script_args=["egg_info"], | ||
name="cve-bin-tool", | ||
entry_points={ | ||
"cve_bin_tool.checker": [ | ||
"{} = cve_bin_tool.checkers.{}:{}".format( | ||
filename.replace(".py", ""), | ||
filename.replace(".py", ""), | ||
"".join( | ||
(filename.replace(".py", "") + " checker") | ||
.replace("_", " ") | ||
.title() | ||
.split() | ||
), | ||
) | ||
for filename in os.listdir( | ||
os.path.join( | ||
os.path.abspath(os.path.dirname(__file__)), "checkers", | ||
) | ||
) | ||
if filename.endswith(".py") and "__init__" not in filename | ||
], | ||
}, | ||
) | ||
) | ||
dist.parse_command_line() | ||
dist.run_commands() | ||
sys.stdout = sys.__stdout__ | ||
os.chdir(cwd) | ||
|
||
|
||
if __name__ == "__main__": | ||
update_egg() |
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.
This block isn't necessary now that we've moved the module into the library, we can import with
from . import egg_updater
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.
I have done it.