Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upModify AIX platform_tag so it provides PEP425 needs #190
Conversation
| @@ -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(): | |||
| ''' | |||
brettcannon
Aug 26, 2019
Member
Suggested change
'''
"""
| ''' | |
| """ |
| The program lslpp is used to gather these values. | ||
| The pep425 platform tag for AIX becomes: | ||
| AIX_V_R_M_YYWW_bitness | ||
| ''' |
brettcannon
Aug 26, 2019
Member
Suggested change
'''
"""
| ''' | |
| """ |
| The pep425 platform tag for AIX becomes: | ||
| AIX_V_R_M_YYWW_bitness | ||
| ''' | ||
|
|
brettcannon
Aug 26, 2019
Member
Suggested change
| AIX_V_R_M_YYWW_bitness | ||
| ''' | ||
|
|
||
| from subprocess import Popen, PIPE, DEVNULL |
brettcannon
Aug 26, 2019
Member
Why the inline import?
Why the inline import?
aixtools
Sep 1, 2019
Author
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.
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.
brettcannon
Sep 9, 2019
Member
Imports are generally cheap, so there's no need to hide it unless you're running some extremely performance-sensitive code.
Imports are generally cheap, so there's no need to hide it unless you're running some extremely performance-sensitive code.
| _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") |
brettcannon
Aug 26, 2019
Member
str.format() is preferred.
str.format() is preferred.
aixtools
Sep 1, 2019
Author
Thanks for the comment - I'll do this later in the week.
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. |
|
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 |
|
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! |
For what it's worth, Microsoft offers free evaluation VM images with Windows here. That's what I use personally for any Windows-related open source work. |
|
Thanks. I'll have to figure out how to set all of that up though. Time... atm, though, it seems master does not pass it's own tests. That is, at least my conclusion based on what I see re: #244 - where I seemed to have hit it off all wrong. Happy Holidays all. |
|
Please note: CI failures are not related to the changes in this PR. |
|
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
|
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. |
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.