コード例 #1
0
class DocumentationGroupComboBox(BaseExtendableComboBox):

    DOCU_GROUPS_PATH = utils.getInstallTypePaths(
    )['INSTALLATION_PATHS_BASE']['DOCUMENTATON_PATH']
    NEW_ITEM_TEXT = '+ add a new group'
    NEW_ITEM_WINDOW_LABEL = 'New tool group'
    NEW_ITEM_DESCRIPTION = 'Select new tool documentation group name'
    DFT_INDEX = 0

    #---------------------------------------------------------------------------

    def _setupItems(self):

        toolGroups = set()

        sourcePath = os.path.join(self.DOCU_GROUPS_PATH, 'res', 'source')
        if os.path.exists(sourcePath):
            for location in os.listdir(sourcePath):
                if os.path.isdir(os.path.join(sourcePath, location)):

                    for item in os.listdir(os.path.join(sourcePath, location)):
                        if os.path.isdir(
                                os.path.join(sourcePath, location, item)):
                            toolGroups.add(item)

            for toolGroup in toolGroups:
                self.addItem(toolGroup)

        self.addItem(self.NEW_ITEM_TEXT)
コード例 #2
0
 def _syncGitHubMasterRepository(self):
     
     reposPath = self.procedureItems[bi.InstallationSetupItem.NAME].installTypeItem.REPOS_PATH
     projectName = self.procedureItems[bi.InstallationSetupItem.NAME].projectName
     masterReposPath = os.path.join(reposPath, projectName)
     
     if self.getCurrentInstallType() == bi.BaseInstallType.TYPE_ANSA_CHECK:
         projectName = 'checks'
         masterReposPath = reposPath
     
     # synchronise with github if not there already
     if self.projectSourceType is not bi.MasterReposProjectSourceType:
                     
         if projectName in self.availableTools:
             print('Project exists in master repository')
             
             githubio.Githubio.pushProject(projectName, masterReposPath)
         else:
             print('Creating a new project in master repository')
             
             githubio.Githubio.createProject(projectName, masterReposPath)
             
             # add files to doc repository
             docSourceDir = os.path.join(di.SPHINX_SOURCE,
                 utils.getInstallTypePaths()['GENERAL']['LOCAL_DOCUMENTATION'],
                 self.procedureItems[bi.DocumetationItem.NAME].docuGroup.replace(' ', '_'),
                 projectName) + os.path.sep + '*'
             
             print('Adding new documentation files to doc repository: "%s"' % docSourceDir)
             
             utils.runSubprocess('git add %s' % docSourceDir, cwd=di.SPHINX_SOURCE)
     
     # synchronise documentation
     di.ToolDocumentation.commitToolAdded('Tool: %s (%s) installed.' % (
         projectName, self.procedureItems[bi.VersionItem.NAME].tagName))
コード例 #3
0
ファイル: main.py プロジェクト: fanaSiegl/pyProjectTools
 def _installAnsaChecks(self):
     
     INSTALL_PATHS = utils.getInstallTypePaths()['INSTALLATION_PATHS_TYPE_ANSA_CHECK']
     
     # install last version
     pyProjectPath = INSTALL_PATHS['REPOS_PATH']
             
     installer = pyProjectInstaller.ci.Installer()
     ansaCheckInstallType = pyProjectInstaller.bi.InstallTypeAnsaCheck(installer)
     
     tagList, tagInfo = pyProjectInstaller.bi.LocalReposProjectSourceType.getTagInfo(pyProjectPath)
     
     revision = tagList[-1]
     
     if os.path.exists(os.path.join(INSTALL_PATHS['PRODUCTIVE_VERSION_HOME'], revision)):
         print('Check version up-to-date (%s).' % revision)
     else:
コード例 #4
0
class CodeTypeComboBox(BaseExtendableComboBox):

    NEW_ITEM_TEXT = '+ new language'
    NEW_ITEM_WINDOW_LABEL = 'New language'
    NEW_ITEM_DESCRIPTION = 'Select new programming language group.'

    DFT_LANGUAGE = 'python'
    TOOL_ROOT = utils.getInstallTypePaths(
    )['INSTALLATION_PATHS_TYPE_EXECUTABLE']['PRODUCTIVE_VERSION_HOME']
    IGNORE_ROOT_DIRS = ['bin', 'repos']

    #---------------------------------------------------------------------------

    def _setupItems(self):

        for language in self._getListOfAvailableLanguages():
            self.addItem(language)

        self.DFT_INDEX = self.findText(self.DFT_LANGUAGE)

        self.addItem(self.NEW_ITEM_TEXT)

        self.setCurrentIndex(self.DFT_INDEX)

    #---------------------------------------------------------------------------

    def _getListOfAvailableLanguages(self):

        languages = list()

        for itemName in os.listdir(self.TOOL_ROOT):
            if (os.path.isdir(os.path.join(self.TOOL_ROOT, itemName))
                    and itemName not in self.IGNORE_ROOT_DIRS):

                languages.append(itemName)
        return languages
コード例 #5
0
    def show(self):

        docString = self.parentApplication.installer.procedureItems[
            bi.DocumetationItem.NAME].docString

        TEMPLATE = '''documentation preview
==========================

.. toctree::
   :maxdepth: 2
   
%s

   '''

        srcConf = os.path.join(utils.PATH_RES, 'doc_preview', 'source',
                               'conf.py')
        dst = os.path.join(
            utils.getInstallTypePaths()['INSTALLATION_PATHS_BASE']
            ['DOCUMENTATON_PATH_TEMP'], 'sphinx')

        sourceSphinxPath = os.path.join(dst, 'source')

        # initiate
        if os.path.isdir(dst):
            shutil.rmtree(dst)

        # copy source files
        try:
            projectDocSouce = os.path.join(
                self.parentApplication.installer.pyProjectPath, 'doc',
                'sphinx', 'source')
            shutil.copytree(projectDocSouce, sourceSphinxPath)

            # delete file which should be updated
            if os.path.isfile(os.path.join(sourceSphinxPath, 'conf.py')):
                os.remove(os.path.join(sourceSphinxPath, 'conf.py'))
#             if os.path.isfile(os.path.join(sourceSphinxPath, 'index.rst')):
#                 os.remove(os.path.join(sourceSphinxPath, 'index.rst'))

        except Exception as e:
            print('Failed to copy documentation source files! (%s)' % str(e))

#         if not os.path.isfile(os.path.join(sourceSphinxPath, 'conf.py')):
        shutil.copy(srcConf, os.path.join(sourceSphinxPath, 'conf.py'))

        if os.path.isfile(os.path.join(sourceSphinxPath, 'index.rst')):
            fi = open(os.path.join(sourceSphinxPath, 'index.rst'))
            TEMPLATE = fi.read().replace('.. automodule:: main', '%s')
            fi.close()

        fo = open(os.path.join(sourceSphinxPath, 'index.rst'), 'wt')
        fo.write(TEMPLATE % docString)
        fo.close()

        # create local documentation using installer environment
        envExecutable = utils.getEnvironmentExecutable(utils.PATH_INI)
        utils.runSubprocess(
            '%s -b html -d %s %s %s' %
            (os.path.join(os.path.dirname(envExecutable), 'sphinx-build'),
             os.path.join(dst, 'build', 'doctrees'), sourceSphinxPath,
             os.path.join(dst, 'build', 'html')))

        address = os.path.join(dst, 'build', 'html', 'index.html')

        os.system('%s %s &' % (utils.getDocumentationBrowser(), address))
コード例 #6
0
ファイル: main.py プロジェクト: fanaSiegl/pyProjectTools
 def initiateAnsaToolkit(self):
       
     print('ansa_toolkit initialisation')    
             
     INSTALL_PATHS = utils.getInstallTypePaths()['INSTALLATION_PATHS_TYPE_ANSA_BUTTON']
       
     # create directory structure for ansaTools
     print('Creating directory structure for ansaTools')
      
     ansaToolsLocation = INSTALL_PATHS['PRODUCTIVE_VERSION_HOME']
     if not os.path.exists(ansaToolsLocation):
         ansaToolsSource = os.path.join(utils.PATH_RES, 'templates', 'ansaTools')
         shutil.copytree(ansaToolsSource, ansaToolsLocation, symlinks=True)
     else:
         print('Directory already present: "%s"' % ansaToolsLocation)
      
     # create directory structure for ansa_toolkit
     print('Creating directory structure for ansa_toolkit')
      
     ansaToolKitLocation = os.path.join(
         os.path.dirname(INSTALL_PATHS['PRODUCTIVE_VERSION_HOME']), 'ansa_toolkit')
     if not os.path.exists(ansaToolKitLocation):        
         ansaToolkitSource = os.path.join(utils.PATH_RES, 'templates', 'ansa_toolkit')
         shutil.copytree(ansaToolkitSource, ansaToolKitLocation, symlinks=True)
          
         # create default symbolic link
         symLink = os.path.join(ansaToolKitLocation, 'default')
         try:         
             currentVersion = glob.glob(os.path.join(ansaToolkitSource, 'V.*'))
             tag = os.path.basename(currentVersion[0])
             executable = os.path.join(ansaToolKitLocation, tag)
             if os.path.islink(symLink):
                 os.unlink(symLink)
             os.symlink(executable, symLink)
              
         except Exception as e:
             print('Failed to set default ansa_toolkit version! (%s)' % str(e))
                              
     else:
         print('Directory already present: "%s"' % ansaToolsLocation)
      
     # create directory for ansaTools repository
     print('Creating ansaTools repository directory')
      
     if not os.path.exists(INSTALL_PATHS['REPOS_PATH']):
         os.makedirs(INSTALL_PATHS['REPOS_PATH'])
     else:
         print('Directory already present: "%s"' % INSTALL_PATHS['REPOS_PATH'])
                      
     # create symbolic link to initiateAnsaToolkit
     INSTALL_PATHS = utils.getInstallTypePaths()['INSTALLATION_PATHS_BASE']
      
     symLink = os.path.join(INSTALL_PATHS['GENERAL_PRODUCTIVE_VERSION_BIN'], 'initiateAnsaToolkit') 
     executable = os.path.join(ansaToolsLocation, 'initiateAnsaToolkit', 'initiateAnsaToolkit.py')
      
     if os.path.islink(symLink):
         os.unlink(symLink)
     os.symlink(executable, symLink)
              
     # clone ansaChecksPlistUpdater
     print('Initiating ANSA "checks".')
     
     INSTALL_PATHS = utils.getInstallTypePaths()['INSTALLATION_PATHS_TYPE_ANSA_CHECK']
     if not os.path.exists(INSTALL_PATHS['REPOS_PATH']):
         githubio.Githubio.cloneProject('checks', 
             os.path.dirname(INSTALL_PATHS['REPOS_PATH']))
コード例 #7
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import os
import sys
import re

from domain import utils
from interfaces import githubio

#=============================================================================

INSTALL_PATHS = utils.getInstallTypePaths()['INSTALLATION_PATHS_BASE']
DOCUMENTATON_PATH = INSTALL_PATHS['DOCUMENTATON_PATH']
DOC_RES = os.path.join(DOCUMENTATON_PATH, 'res')

SPHINX_SOURCE = os.path.join(DOC_RES, 'source')
SPHINX_DOCTREES = os.path.join(DOC_RES, 'build', 'doctrees')
SPHINX_HTML = os.path.join(DOC_RES, 'build', 'html')

#=============================================================================


class Tool(object):

    instances = list()

    VERSION_PATTERN = r'.*\*{1}\s+commit\s+(.*)\s+\({1}.*,\s+tag:\s+(V\.\d+\.\d+\.\d+).*'
    DOCUMENTATON_DESCRIPTION_LINE_NO = 2

    def __init__(self, parentGroup, name):