Esempio n. 1
0
    def gather_dependencies(self):
        log.info('gathering dependencies...')
        self.npm(['shrinkwrap'])
        shrinkwrapFile = join(self.module_dir, 'npm-shrinkwrap.json')
        if is_existing_file(shrinkwrapFile):
            move(shrinkwrapFile, self.shrinkwrap)

        # clean shrinkwrap file see spec on https://wiki.wdf.sap.corp/wiki/display/xs2/Filtering+SAP-internal+metadata+before+release
        cleanedShrinwrap = {}
        with open(self.shrinkwrap, 'r') as f:
            cleanedShrinwrap = json.load(f)

        keystoremove = []
        self._clean_shrinkwrap(cleanedShrinwrap,
                               listofkeytoremove=keystoremove)
        for keys in keystoremove:
            shrinkwrappart = cleanedShrinwrap
            for key in keys[:-1]:
                shrinkwrappart = shrinkwrappart[key]
            shrinkwrappart.pop(keys[-1], None)

        with open(self.shrinkwrap, 'w') as jsonfile:
            json.dump(cleanedShrinwrap, jsonfile, indent=2)

        dep = self.module_dir
        p = Properties()
        for (m, v) in self.list_deps(join(dep), ''):
            p.setProperty(m, v)
        with open(self.deps, 'w') as f:
            p.store(f)
        copyfile(self.deps, join(dep, 'dependencies'))
Esempio n. 2
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print 'Adium WARNING: "' + loadfile + '" does not exist! Reading from:'
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print '\t"' + loadfile + '"'

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.iteritems():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if 'x' in key:
                suffix2 = ''
                if '@' in key['name']:
                    suffix = re.sub('[^a-zA-Z0-9_]', '_', key['name'].split('@')[1])
                    if 'facebook' in key['name'].split('@')[1]:
                        protocolAcc = 'Facebook_'
                    elif 'gmail' in key['name'].split('@')[1]:
                        protocolAcc = 'Google_Talk_'
                        suffix2 = 'talk_google_com'
                    else:
                        protocolAcc = 'Jabber_'
                elif '@' not in key['name']:
                    if 'icq' in key['protocol']:
                        protocolAcc = 'ICQ_'
                        suffix = 'icq_com'
                    elif 'yahoo' in key['protocol']:
                        protocolAcc = 'Yahoo__'
                        suffix = 'yahoo_com'
                # Writing
                pubkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_' + suffix + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                           + '_' + suffix + '_privateKey')
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
		   
                if suffix2 != '':
                    pubkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                              + '_' + suffix2 + '_publicKey')
                    p.setProperty(pubkey, util.ExportDsaX509(key))
                    privkey = (propkey_base + protocolAcc + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_' + suffix2 + '_privateKey')
                    p.setProperty(privkey, util.ExportDsaPkcs8(key))	
		   		
        p.store(open(savefile, 'w'))
Esempio n. 3
0
def write_version_properties(build_cfg):
    p = Properties()
    log.info('version is ' + build_cfg.version())
    log.info('scm_url is ' + str(build_cfg.scm_snapshot_url()))
    p.setProperty('release_version', build_cfg.version())
    p.setProperty('scm_url', str(build_cfg.scm_snapshot_url()))

    #     pairs = [('release_version', build_cfg.version()),
    #              ('scm_url', build_cfg.scm_snapshot_url())]
    #     contents = '\n'.join([key + '=' + str(value) for (key, value) in pairs])
    with open(build_cfg.version_properties_file(), 'w') as f:
        p.store(f)
Esempio n. 4
0
 def write_to_report():
     prop = Properties()
     out = open(globals.ALLURE_RESULTS + "environment.properties", mode='w')
     prop.setProperty("Browser", ReadConfig.browser())
     prop.setProperty("URL", ReadConfig.get_url())
     prop.setProperty("Python", str(sys.version))
     window_version = str(sys.getwindowsversion())
     prop.setProperty("Platform", window_version.title())
     prop.store(out)
Esempio n. 5
0
File: jitsi.py Progetto: duy/keysync
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(
                JitsiProperties.path):
            print 'Adium WARNING: "' + loadfile + '" does not exist! Reading from:'
            loadfile = os.path.join(JitsiProperties.path,
                                    JitsiProperties.propertiesfile)
            print '\t"' + loadfile + '"'

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.iteritems():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base +
                               re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                               '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base +
                          re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                          '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if 'x' in key and '@' in key['name']:
                pubkey = (
                    propkey_base + 'Jabber_' +
                    re.sub('[^a-zA-Z0-9_]', '_', key['name']) + '_' +
                    re.sub('[^a-zA-Z0-9_]', '_', key['name'].split('@')[1]) +
                    '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (
                    propkey_base + 'Jabber_' +
                    re.sub('[^a-zA-Z0-9_]', '_', key['name']) + '_' +
                    re.sub('[^a-zA-Z0-9_]', '_', key['name'].split('@')[1]) +
                    '_privateKey')
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
        p.store(open(savefile, 'w'))
Esempio n. 6
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print 'Adium WARNING: "' + loadfile + '" does not exist! Reading from:'
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print '\t"' + loadfile + '"'

        propkey_base = "net.java.sip.communicator.plugin.otr."
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.iteritems():
            if "verification" in key and key["verification"] != "":
                verifiedkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey_verified"
                p[verifiedkey] = "true"
            if "y" in key:
                pubkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey"
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if "x" in key and "@" in key["name"]:
                pubkey = (
                    propkey_base
                    + "Jabber_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"].split("@")[1])
                    + "_publicKey"
                )
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (
                    propkey_base
                    + "Jabber_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"].split("@")[1])
                    + "_privateKey"
                )
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
        p.store(open(savefile, "w"))
Esempio n. 7
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print('Jitsi NOTICE: "' + loadfile + '" does not exist! Reading from:')
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print('\t"' + loadfile + '"')

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.items():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
            if 'x' in key:
                protocol_id = 'UNKNOWN_'
                domain_id = 'unknown'
                servername = None
                if '@' in key['name']:
                    domainname = key['name'].split('@')[1]
                    domain_id = re.sub('[^a-zA-Z0-9_]', '_', domainname)
                    if domainname == 'chat.facebook.com':
                        protocol_id = 'Facebook_'
                    elif domainname == 'gmail.com' \
                            or domainname == 'google.com' \
                            or domainname == 'googlemail.com':
                        protocol_id = 'Google_Talk_'
                        servername = 'talk_google_com'
                    else:
                        protocol_id = 'Jabber_'
                else:
                    if key['protocol'] == 'prpl-icq':
                        protocol_id = 'ICQ_'
                        domain_id = 'icq_com'
                    elif key['protocol'] == 'prpl-yahoo':
                        protocol_id = 'Yahoo__'
                        domain_id = 'yahoo_com'
                # Writing
                pubkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                          + '_' + domain_id + '_publicKey')
                p.setProperty(pubkey, util.ExportDsaX509(key))
                privkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                           + '_' + domain_id + '_privateKey')
                p.setProperty(privkey, util.ExportDsaPkcs8(key))
		   
                if servername:
                    pubkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                              + '_' + servername + '_publicKey')
                    p.setProperty(pubkey, util.ExportDsaX509(key))
                    privkey = (propkey_base + protocol_id + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_' + servername + '_privateKey')
                    p.setProperty(privkey, util.ExportDsaPkcs8(key))	
		   		
        p.store(open(savefile, 'w'))
Esempio n. 8
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(
                JitsiProperties.path):
            print('Jitsi NOTICE: "' + loadfile +
                  '" does not exist! Reading from:')
            loadfile = os.path.join(JitsiProperties.path,
                                    JitsiProperties.propertiesfile)
            print('\t"' + loadfile + '"')

        propkey_base = 'net.java.sip.communicator.plugin.otr.'
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.items():
            if 'verification' in key and key['verification'] != '':
                verifiedkey = (propkey_base +
                               re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                               '_publicKey_verified')
                p[verifiedkey] = 'true'
            if 'y' in key:
                pubkey = (propkey_base +
                          re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                          '_publicKey')
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
            if 'x' in key:
                protocol_id = 'UNKNOWN_'
                domain_id = 'unknown'
                servername = None
                if '@' in key['name']:
                    domainname = key['name'].split('@')[1]
                    domain_id = re.sub('[^a-zA-Z0-9_]', '_', domainname)
                    if domainname == 'chat.facebook.com':
                        protocol_id = 'Facebook_'
                    elif domainname == 'gmail.com' \
                            or domainname == 'google.com' \
                            or domainname == 'googlemail.com':
                        protocol_id = 'Google_Talk_'
                        servername = 'talk_google_com'
                    else:
                        protocol_id = 'Jabber_'
                else:
                    if key['protocol'] == 'prpl-icq':
                        protocol_id = 'ICQ_'
                        domain_id = 'icq_com'
                    elif key['protocol'] == 'prpl-yahoo':
                        protocol_id = 'Yahoo__'
                        domain_id = 'yahoo_com'
                # Writing
                pubkey = (propkey_base + protocol_id +
                          re.sub('[^a-zA-Z0-9_]', '_', key['name']) + '_' +
                          domain_id + '_publicKey')
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                privkey = (propkey_base + protocol_id +
                           re.sub('[^a-zA-Z0-9_]', '_', key['name']) + '_' +
                           domain_id + '_privateKey')
                p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

                if servername:
                    pubkey = (propkey_base + protocol_id +
                              re.sub('[^a-zA-Z0-9_]', '_', key['name']) + '_' +
                              servername + '_publicKey')
                    p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                    privkey = (propkey_base + protocol_id +
                               re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                               '_' + servername + '_privateKey')
                    p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

        p.store(open(savefile, 'w'))
 def _testParsePropertiesOutput(self, stream):
   properties = Properties()
   properties.setProperty('Key00', 'Value00')
   properties.setProperty('Key01', 'Value01')
   properties.setProperty('Key02', 'Value02')
   properties.setProperty('Key03', 'Value03')
   properties.setProperty('Key04', 'Value04')
   properties.setProperty('Key05', 'Value05a, Value05b, Value05c')
   properties.setProperty('Key06', 'Value06a, Value06b, Value06c',)
   properties.setProperty('Key07', 'Value07b')
   properties.setProperty('Key08',
       'Value08a, Value08b, Value08c, Value08d, Value08e, Value08f')
   properties.setProperty('Key09',
       'Value09a, Value09b, Value09c, Value09d, Value09e, Value09f')
   properties.setProperty('Key10', 'Value10')
   properties.setProperty('Key11', '')
   properties.setProperty('Key12', 'Value12a, Value12b, Value12c')
   properties.setProperty('Key13', 'Value13 With Spaces')
   properties.setProperty('Key14', 'Value14 With Spaces')
   properties.setProperty('Key15', 'Value15 With Spaces')
   properties.setProperty('Key16 With Spaces', 'Value16')
   properties.setProperty('Key17 With Spaces', 'Value17')
   properties.setProperty('Key18', 'Value18 # Not a comment.')
   properties.setProperty('Key19', 'Value19 ! Not a comment.')
   properties.setProperty('Key20=WithEquals', 'Value20')
   properties.setProperty('Key21:WithColon', 'Value21')
   properties.setProperty('Key22', 'Value22')
   properties.store(stream)
Esempio n. 10
0
    def write(keydict, savedir):
        if not os.path.exists(savedir):
            raise Exception('"' + savedir + '" does not exist!')

        loadfile = os.path.join(savedir, JitsiProperties.propertiesfile)
        savefile = loadfile
        if not os.path.exists(loadfile) and os.path.exists(JitsiProperties.path):
            print('Jitsi NOTICE: "' + loadfile + '" does not exist! Reading from:')
            loadfile = os.path.join(JitsiProperties.path, JitsiProperties.propertiesfile)
            print('\t"' + loadfile + '"')

        propkey_base = "net.java.sip.communicator.plugin.otr."
        p = Properties()
        p.load(open(loadfile))
        for name, key in keydict.items():
            if "verification" in key and key["verification"] != "":
                verifiedkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey_verified"
                p[verifiedkey] = "true"
            if "y" in key:
                pubkey = propkey_base + re.sub("[^a-zA-Z0-9_]", "_", key["name"]) + "_publicKey"
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
            if "x" in key:
                protocol_id = "UNKNOWN_"
                domain_id = "unknown"
                servername = None
                if "@" in key["name"]:
                    domainname = key["name"].split("@")[1]
                    domain_id = re.sub("[^a-zA-Z0-9_]", "_", domainname)
                    if domainname == "chat.facebook.com":
                        protocol_id = "Facebook_"
                    elif domainname == "gmail.com" or domainname == "google.com" or domainname == "googlemail.com":
                        protocol_id = "Google_Talk_"
                        servername = "talk_google_com"
                    else:
                        protocol_id = "Jabber_"
                else:
                    if key["protocol"] == "prpl-icq":
                        protocol_id = "ICQ_"
                        domain_id = "icq_com"
                    elif key["protocol"] == "prpl-yahoo":
                        protocol_id = "Yahoo__"
                        domain_id = "yahoo_com"
                # Writing
                pubkey = (
                    propkey_base
                    + protocol_id
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + domain_id
                    + "_publicKey"
                )
                p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                privkey = (
                    propkey_base
                    + protocol_id
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_"
                    + domain_id
                    + "_privateKey"
                )
                p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

                if servername:
                    pubkey = (
                        propkey_base
                        + protocol_id
                        + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                        + "_"
                        + servername
                        + "_publicKey"
                    )
                    p.setProperty(pubkey, otrapps.util.ExportDsaX509(key))
                    privkey = (
                        propkey_base
                        + protocol_id
                        + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                        + "_"
                        + servername
                        + "_privateKey"
                    )
                    p.setProperty(privkey, otrapps.util.ExportDsaPkcs8(key))

        p.store(open(savefile, "w"))
Esempio n. 11
0
from pyjavaproperties import Properties

file_name="/Users/smandaki/PycharmProjects/DataDriven/data/config.properties"
output_Sterm=open(file_name, "a")
prop= Properties()
prop.setProperty(key='ValueOfPi', value="double,valueTesting")
prop.store(output_Sterm)
output_Sterm.close()

input_stream=open(file_name, "r")
prop1=Properties()
prop1.load(input_stream)
newval=prop.getProperty("ValueOfPi")
Str1=newval.split(',')
print(Str1[0])
print(Str1[1])
input_stream.close()

'''
file_path = "/Users/smandaki/PycharmProjects/DataDriven/data/config.properties"
output_file = open(file_path, 'a')
prop = Properties()
prop.setProperty(key="Users", value='Agent,Admin')
prop.store(output_file)
output_file.close()


input_stream = open(file_path, mode='r')
prop = Properties()
prop.load(input_stream)