-
Notifications
You must be signed in to change notification settings - Fork 256
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
Modify AIX platform_tag so it provides PEP425 needs #190
Conversation
packaging/tags.py
Outdated
@@ -310,6 +310,42 @@ def _have_compatible_glibc(required_major, minimum_minor): | |||
return _check_glibc_version(version_str, required_major, minimum_minor) | |||
|
|||
|
|||
def _aix_tag(): | |||
''' |
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.
''' | |
""" |
packaging/tags.py
Outdated
The program lslpp is used to gather these values. | ||
The pep425 platform tag for AIX becomes: | ||
AIX_V_R_M_YYWW_bitness | ||
''' |
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.
''' | |
""" |
packaging/tags.py
Outdated
The pep425 platform tag for AIX becomes: | ||
AIX_V_R_M_YYWW_bitness | ||
''' | ||
|
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.
packaging/tags.py
Outdated
AIX_V_R_M_YYWW_bitness | ||
''' | ||
|
||
from subprocess import Popen, PIPE, DEVNULL |
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.
Why the inline import?
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 tried to respond to this, days ago, via email. I still do not see my reply - so I'll try again.
Basically, I was thinking - if not _AIX, then why import something additional that noone else is using. Simple enough to move to global imports.
p.s. I will be trying to get an _aix_support (similar to _osx_support) added into CPython, that would make this unneeded.
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.
Imports are generally cheap, so there's no need to hide it unless you're running some extremely performance-sensitive code.
packaging/tags.py
Outdated
_lslppLqc = p.stdout.read().strip().split(":") | ||
p.wait() | ||
(lpp, vrmf, bd) = list(_lslppLqc[index] for index in [0, 2, -1]) | ||
assert lpp == "bos.mp64", "%s != %s" % (lpp, "bos.mp64") |
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.
str.format()
is preferred.
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.
Thanks for the comment - I'll do this later in the week.
Related to #188. That issue also contains a link to a broader discussion happening over on pip's issue tracker. |
1ebd62e
to
66d7b40
Compare
I'll run tox seperately, to try and figure out why it is failing ci, but better for me would be a pointer to the documentation I am sure is there - on how to test the code. tox -e lint passes locally, failed just now because of some HTTP server error. The other tests fail showing this block:
Thanks for pointers! |
You can either read the |
66d7b40
to
e74cdc6
Compare
Well, I am getting - read have become - so frustrated trying to figure out how mypi 'works' that I'll just give up on the whole project. A wasted day. |
@aixtools if you're giving up then I'm going to close this PR. If you choose to try again then feel free to open the PR once more. |
Reopen? How? Only button I see is delete branch. Sigh - refrain from other comments re: frustration - as they are too likely to be misunderstood. p.s. I was hoping for some assistance with dealing with mypi. |
@aixtools from my understanding mypy considers that sysconfig.get_config_var is an from sysconfig import get_config_var
def test() -> str:
value = get_config_var("test")
if value is None:
# or raise ValueError ?
return ""
return value |
@xavfernandez - Many Thanks - that helped a lot. Python still makes my head spin when it comes to how the "absolute" typing of things constantly changes. I have modified this little bit many times - as I get into issues with what is available "when". So, while lint (read mypy) gets further, I am still stuck in what appears to be a circle for me. Or is the only solution to write another helper function to nudge typing. Currently - stuck with:
I have also tried # type: ignore
Also, a hint to see what
Merci! |
Some help - with mypi - is much appreciated. I just go in circles. If I understand correctly, there is some 'science' that can be done to satisfy mypi - but it is too much 'magic' for me at this point. I just go around in circles - same error, or new error. Very frustrating. |
@aixtools This should work: diff --git a/packaging/_AIX_platform.py b/packaging/_AIX_platform.py
index 6d77aa0..64bd31e 100644
--- a/packaging/_AIX_platform.py
+++ b/packaging/_AIX_platform.py
@@ -17,12 +17,11 @@ def aix_tag(v, r, tl, bd):
def aix_buildtag():
# type: () -> str
- bd = get_var("AIX_BUILDDATE") # type: str
- # because I do not understand howto tell mypi that
- # get_var() returns a string _ I getting it to a temp variable
- # and using that as argument to split()
- # v, r, tl, f = get_var("BUILD_GNU_TYPE").split(".")
- gt = get_var("BUILD_GNU_TYPE") # type: str
+ bd = get_var("AIX_BUILDDATE")
+ assert bd
+
+ gt = get_var("BUILD_GNU_TYPE")
+ assert gt
v, r, tl, f = gt.split(".")
return aix_tag(v[-1], r, tl, bd)
@@ -47,7 +46,7 @@ def aix_pep425():
# p = run(["/usr/bin/lslpp", "-Lqc", "bos.mp64"],
# capture_output=True, text=True)
result = check_output(["/usr/bin/lslpp", "-Lqc", "bos.mp64"])
- result = result.decode("utf-8").strip().split(":") # type : ignore
+ result = result.decode("utf-8").strip().split(":") # type: ignore
(lpp, vrmf, bd) = list(result[index] for index in [0, 2, -1])
assert lpp == "bos.mp64", "%s != %s" % (lpp, "bos.mp64") I don't have much bandwidth to comment further or do a review, but checking locally, this seems to fix the mypy warnings. |
@pradyunsg Thx. Shall give it a try. As mypy was still failing I had not bothered to post my latest changes. So. I'll stash and try again. |
@pradyunsg - success for mypy, but tox -e py37 fails, I guess on So, packaging/_AIX_platform.py has 0% coverage, and packaging/tags.py drops to 98%. Again, hints welcome (I'll push these changes, even though failure is expected).
|
@aixtools the |
I guessed as much, and have been playing. But in all honesty, it has taken me 400% more time to try to understand, let alone accomplish, the additional tasks to get it past CI. My approach has always been to insert as little as possible to the existing code - merely a trigger, such as platform.system == "AIX" and have all my contribution external to the existing project. I suppose if your main interest in life is Python, you have either had all of these subjects in school, training at work, or just because you have done other projects. It feels (think something very negative) and also becomes extremely distracting. I have actually forgotten some of my ideas re: step by step progression. And now I fear something I had hoped might be accomplished in a few weeks may not be finished in a year - just because I run out of time between (work) trips - to get this past your requirements. Well, time to get ready of tomorrow. I'll see when I can get back to this. Please do not close just because I lack time and/or skills to work with all these additional requirements. I shall not be updating the PR to test - I test locally as best I can and then push. update: just checking (read hoping) for suggestions. |
I spent hours trying different things to get the last bit of code in packaging/tags.py to be covered, but I cannot find anything to convince the tool that the code is executing. I can force errors and see that it gets reached. After hours, stuck with this:
|
OMG!! They all passed! I guess I should celebrate - like when my daughter said - hey grandpa, it's a boy! |
Hmm - says I left a review. If so, by accident. Rebase, etc. etc. is making a big mess. Not a slight change.... Bah conflicts! |
CI failures are not related to the changes in this PR. |
9 days further. Any comments? I cannot resolve the CI issues - as they have nothing to do with my proposal. |
Question: What happens if I press the button "Update Branch"? |
@di Thanks for the help (magic!) |
Remove all references to old name _AIX_platform.py
Rename module used for monkeypatch
* Make our mypy type-casting magic more robust Newer versions of mypy are better at following code flow, and assign Any types to our reimplemented cast function. This commit significantly restructures our typing.cast re-definition, to make it more robust. * Rename MYPY_CHECK_RUNNING -> TYPE_CHECKING This allows for some significant cleanups in our typing helpers, and makes it much easier to document our... workarounds. * Bump to newer mypy * Improve `canonicalize_name` safety with type hints
add56af
to
68e9c80
Compare
Well, changes to codebase - seems what was working no longer works. Will take this up again later when I have more time to investigagte what, exactly, I need to update on my system so I can run these tests locally. |
from tests/test_tags.py
Additional conflicts in coding expected due to changes in `master`.
working through typos - slowly.
As I am working - as before - with py36 - what do I need to do extra to use Thx. |
OK. Next step: One of my new tests looks like:
Something seems to have changed - because a year ago - the sysconfig.get_config_var('GNU_BUILD_TYPE') would return
The test now fails - because the monkeypatch value is not getting pickup. What do I need to change in:
so that the correct value is returned. FYI: the current python returns (when _have_subprocess is TRUE)
Not the value shown in the CI test:
Many thanks for your assistence. |
I'm going to close this as I think adding tag support is a rather serious ask since it's one of the hardest things to keep supporting. If there's still a desire to have AIX tags then we should open an issue about it and discuss how we want to manage what platforms we add tag support for when there isn't wide community demand for it (no offence to AIX). |
Actually, The better reason for closing this is because tag support is built-in since Python3.9. This was my attempt to integrate THAT code into this package so that bdist would work properly for earlier versions of Python for AIX that does not have Lib/_aix_support.py |
Provide an adequate platform tag for AIX. The generic tag provided by distutils.util.get_platform() is insufficient - besides missing "bitness" it does not provide any information regarding Technology Level, nor build date.