strycore / fakegir

fakegir: Bring autocompletion to your PyGObject code
GNU General Public License v3.0
92 stars 16 forks source link

Problem with files *.gir #22

Closed ericktucto closed 6 years ago

ericktucto commented 6 years ago

The following files do not finish generating

Example '/usr/share/gir-1.0/NM-1.0.gir',

2018_06_23_001

I add if statement

def generate_fakegir():
    """Main function"""
    fakegir_repo_dir = os.path.join(FAKEGIR_PATH, 'gi/repository')
    if not os.path.exists(fakegir_repo_dir):
        os.makedirs(fakegir_repo_dir)

    gi_init_path = os.path.join(FAKEGIR_PATH, 'gi/__init__.py')
    with open(gi_init_path, 'w') as gi_init_file:
        gi_init_file.write('')
    repo_init_path = os.path.join(FAKEGIR_PATH, 'gi/repository/__init__.py')
    with open(repo_init_path, 'w') as repo_init_file:
        repo_init_file.write('')

    for module_name, gir_path in iter_girs():
        if gir_path in PASS:
            continue

        fakegir_content = parse_gir(gir_path)
        fakegir_path = os.path.join(FAKEGIR_PATH, 'gi/repository',
                                    module_name + ".py")
        with open(fakegir_path, 'w') as fakegir_file:
            fakegir_file.write("# -*- coding: utf-8 -*-\n")
            fakegir_file.write(fakegir_content)
PASS = (
    '/usr/share/gir-1.0/NM-1.0.gir',
    '/usr/share/gir-1.0/Atspi-2.0.gir',
    '/usr/share/gir-1.0/GstCheck-1.0.gir',
    '/usr/share/gir-1.0/GExiv2-0.10.gir',
    '/usr/share/gir-1.0/Dbusmenu-0.4.gir',
    '/usr/share/gir-1.0/HarfBuzz-0.0.gir'
)
kastixx commented 6 years ago

This issue is most probably caused by the same problem as #24

kastixx commented 6 years ago

There's a workaround in PR #25. Please check if it works for you.

kmare commented 6 years ago

I had the same problem on Fedora 28. Applied the patch and I can confirm it finally works. Thank you!

strycore commented 6 years ago

Merged the PR, should be ok now