655 except EnvironmentError: |
655 except EnvironmentError: |
656 print("Could not install '{2}{0}{1}'.".format( |
656 print("Could not install '{2}{0}{1}'.".format( |
657 os.sep, name, sourceDir)) |
657 os.sep, name, sourceDir)) |
658 |
658 |
659 # install the API file |
659 # install the API file |
|
660 from PyQt4.QtCore import qVersion |
660 for progLanguage in progLanguages: |
661 for progLanguage in progLanguages: |
661 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
662 apidir = os.path.join(cfg['apidir'], progLanguage.lower()) |
662 if not os.path.exists(apidir): |
663 if not os.path.exists(apidir): |
663 os.makedirs(apidir) |
664 os.makedirs(apidir) |
664 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
665 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
682 except EnvironmentError: |
683 except EnvironmentError: |
683 print("Could not install '{0}'.".format(apiName)) |
684 print("Could not install '{0}'.".format(apiName)) |
684 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
685 for apiName in glob.glob(os.path.join(sourceDir, "APIs", |
685 "Python3", "*.bas")): |
686 "Python3", "*.bas")): |
686 try: |
687 try: |
687 shutilCopy(apiName, apidir) |
688 if os.path.basename(apiName).startswith("PyQt4"): |
|
689 # only install the PyQt4 file matching the Qt version |
|
690 if os.path.splitext(apiName)[0].endswith( |
|
691 qVersion().split(".")[0]): |
|
692 shutilCopy(apiName, |
|
693 os.path.join(apidir, "PyQt4.bas")) |
|
694 continue |
|
695 if os.path.exists(os.path.join( |
|
696 apidir, os.path.basename( |
|
697 apiName.replace(".bas", ".api")))): |
|
698 shutilCopy(apiName, apidir) |
688 except EnvironmentError: |
699 except EnvironmentError: |
689 print("Could not install '{0}'.".format(apiName)) |
700 print("Could not install '{0}'.".format(apiName)) |
690 |
701 |
691 # create menu entry for Linux systems |
702 # create menu entry for Linux systems |
692 if sys.platform.startswith("linux"): |
703 if sys.platform.startswith("linux"): |