-
Notifications
You must be signed in to change notification settings - Fork 7
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
Failing with "missing metadata.json" message when trying to upload a wheel #8
Comments
I get the same one. If I try to upload
|
still no solution? |
The issue is in the wheel files. The workaround is to parse the METADATA file as a fallback, using effectively the same strategy as Something like this works for me, but I'm still testing different packages, def __extract_wheel(self, zpfile):
class InfoCmd(object):
def __init__(self):
self.metadata = {}
def __call__(self, target):
m = json.loads(target.read())
self.metadata["name"] = m["name"]
self.metadata["version"] = m["version"]
self.metadata["requirements"] = set([])
for reqs in m.get("run_requires", []):
self.metadata["requirements"].update(reqs["requires"])
class BackupInfoCmd(object):
def __init__(self):
self.metadata = {}
def __call__(self, target):
m = {}
for line in target.readlines():
try:
if len(line.split(":")) > 1:
k, v = line.split(":", 1)
if k.upper().strip() not in m:
m[k.upper().strip()] = []
m[k.upper().strip()].append(v.strip())
except ValueError:
logging.exception("Failed to parse line '{}'".format(line))
self.metadata["name"] = "".join(m["name".upper()])
self.metadata["version"] = "".join(m["version".upper()])
self.metadata["requirements"] = set([])
for r in m.get("Requires-Dist".upper(), []):
self.metadata["requirements"].add(r)
cmd = InfoCmd()
self.__seek_and_apply(zpfile, "metadata.json", cmd)
if not cmd.metadata:
cmd = BackupInfoCmd()
self.__seek_and_apply(zpfile, "METADATA", cmd)
if not cmd.metadata:
raise InvalidState("Could not find metadata.json")
return cmd.metadata |
i have found the same error, and seems related to #9 |
Took @caseyduquettesc proto-patch above and applied it in PR #13 |
@jerryvurbl |
Trying to upload a wheel which works perfectly in other usages fails with the message:
invalid state: Could not find metadata.json
The text was updated successfully, but these errors were encountered: