See pyecore/pyecore#126 (comment)
Quoting from there, for enums,
pyecoregen generates the wrong code:
for classif in otherClassifiers:
eClassifiers[classif.name] = classif
classif.ePackage = eClass
for classif in eClassifiers.values():
eClass.eClassifiers.append(classif.eClass)
What happens is that, initially, eClassifiers is empty. Then, first, enums are added to eClassifiers, and then the eClass of each object in eClassifiers is added to the EPackage (that for some reason is called eClass). So we have the EEnum class added to the package we're defining! And, of course, it gets removed from the Ecore package, because eClassifiers is a containment relationship. I don't know the purpose of the second for loop, maybe it was to handle custom metaclasses or stuff like that, but it should filter the classes that it puts into eClass, or be removed altogether if it's not necessary.
See pyecore/pyecore#126 (comment)
Quoting from there, for enums,