Example #1
0
def index_generator(conf_slug=settings.DEFAULT_CONF, dev=False):
    template = render_to_string('prebuild-index.html', {})

    base = '/{}/app-{}'.format(conf_slug, release())

    if dev:
        scripts = ''
        for script in SCRIPTS:
            scripts += '<script src="{}/{}"></script>\n'.format(base, script)

    else:
        scripts = '<script src="{}/compressed.js"></script>'.format(base)

    context = dict(
        base=base,
        conf=conf_slug,
        api_base='/',
        release=release(),
        app_base='app-{}'.format(release()),
        scripts=scripts,
    )

    html = Template(template).safe_substitute(context)
    pattern = '<!--dev-->(.*?)<!--dev-end-->'
    if dev:
        pattern = '<!--prod-->(.*?)<!--prod-end-->'

    html = re.sub(pattern, '', html, flags=re.S)
    return html
Example #2
0
    async def do_release(self, repo_info, version):
        """
        Start a new release and wait for deployment

        Args:
            repo_info (RepoInfo): Information for a repo
            version (str): The version
        """
        repo_url = repo_info.repo_url
        channel_id = repo_info.channel_id
        release(repo_url, version)

        await self.say(
            channel_id,
            "Behold, my new evil scheme - release {}! Now deploying to RC...".
            format(version))

        await wait_for_deploy(repo_url, repo_info.rc_hash_url,
                              "release-candidate")
        org, repo = get_org_and_repo(repo_url)
        unchecked_authors = get_unchecked_authors(org, repo, version)
        slack_usernames = self.translate_slack_usernames(unchecked_authors)
        await self.say(
            channel_id,
            "Release {version} was deployed! PR is up at <{pr_url}|Release {version}>."
            " These people have commits in this release: {authors}".format(
                version=version,
                authors=", ".join(slack_usernames),
                pr_url=get_release_pr(org, repo, version)['html_url'],
            ))
Example #3
0
    async def release_command(self, command_args):
        """
        Start a new release and wait for deployment

        Args:
            command_args (CommandArgs): The arguments for this command
        """
        repo_info = command_args.repo_info
        version = command_args.args[0]
        repo_url = repo_info.repo_url
        channel_id = repo_info.channel_id
        org, repo = get_org_and_repo(repo_url)
        pr = get_release_pr(self.github_access_token, org, repo)
        if pr:
            raise ReleaseException(
                "A release is already in progress: {}".format(pr.url))
        release(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            new_version=version,
        )

        await self.say(
            channel_id=channel_id,
            text=
            "Behold, my new evil scheme - release {version} for {project}! Now deploying to RC..."
            .format(
                version=version,
                project=repo_info.name,
            ),
        )

        await wait_for_deploy(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            hash_url=repo_info.rc_hash_url,
            watch_branch="release-candidate",
        )
        unchecked_authors = get_unchecked_authors(self.github_access_token,
                                                  org, repo)
        slack_usernames = self.translate_slack_usernames(unchecked_authors)
        pr = get_release_pr(self.github_access_token, org, repo)
        await self.say(
            channel_id=channel_id,
            text=
            "Release {version} for {project} was deployed! PR is up at {pr_url}."
            " These people have commits in this release: {authors}".format(
                version=version,
                authors=", ".join(slack_usernames),
                pr_url=pr.url,
                project=repo_info.name,
            ))

        await self.wait_for_checkboxes(repo_info, command_args.manager)
        command_args.loop.create_task(self.delay_message(repo_info))
Example #4
0
    async def _web_application_release(self, command_args):
        """Do a web application release"""
        repo_info = command_args.repo_info
        version = command_args.args[0]
        repo_url = repo_info.repo_url
        channel_id = repo_info.channel_id
        org, repo = get_org_and_repo(repo_url)

        release(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            new_version=version,
        )
        await self.say(
            channel_id=channel_id,
            text="Behold, my new evil scheme - release {version} for {project}! Now deploying to RC...".format(
                version=version,
                project=repo_info.name,
            ),
        )

        await wait_for_deploy(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            hash_url=repo_info.rc_hash_url,
            watch_branch="release-candidate",
        )
        unchecked_authors = get_unchecked_authors(
            github_access_token=self.github_access_token,
            org=org,
            repo=repo,
        )
        slack_usernames = self.translate_slack_usernames(unchecked_authors)
        pr = get_release_pr(
            github_access_token=self.github_access_token,
            org=org,
            repo=repo,
        )
        await self.say(
            channel_id=channel_id,
            text="Release {version} for {project} was deployed! PR is up at {pr_url}."
            " These people have commits in this release: {authors}".format(
                version=version,
                authors=", ".join(slack_usernames),
                pr_url=pr.url,
                project=repo_info.name,
            )
        )

        await self.wait_for_checkboxes(repo_info, command_args.manager)
        command_args.loop.create_task(self.delay_message(repo_info))
Example #5
0
def search_release (term):
	sFktname = "search_release"

	term = term.replace(" ","+")

	ePrint(1, sFktname, "search the web")

	# search on chemical
	query_chemical = chemical.chemical()
	results = query_chemical.search(term)

	# case if nothing was found
	if len(results) == 0:
		ePrint(1, sFktname, "nothing found on chemical")
		return None

	# case, if more then one was found
	if len(results) > 1:
		ePrint(1, sFktname, "Multiple Links found. Make a Choice\n")
		k = 0
		for i in results:
			print("{0:3d}:\t{1}".format(k , results[k][1]))
			k = k + 1
		print("\n")
		choice = int(input(" <-- "))
		results = [ [ results[choice][0], results[choice][1] ] ]
	
	# create an release instance and feed it
	rel = release()
	rel.shortinfo = results[0][1]
	rel.infopage = results[0][0]
	rel = query_chemical.getReleaseInfo(rel)

	return rel
Example #6
0
def index_generator(conf_slug=settings.DEFAULT_CONF, dev=False):
    template = render_to_string('prebuild-index.html', {})

    context = dict(
        base='/{}/app-{}'.format(conf_slug, release()),
        conf=conf_slug,
        api_base='/',
        release=release(),
        app_base='app-{}'.format(release()),
    )

    html = Template(template).safe_substitute(context)
    pattern = '<!--dev-->(.*?)<!--dev-end-->'
    if dev:
        pattern = '<!--prod-->(.*?)<!--prod-end-->'

    html = re.sub(pattern, '', html, flags=re.S)
    return html
Example #7
0
 def handle (self, *args, **options):
   slug = options['conf_slug']
   
   os.chdir(settings.BASE_DIR)
   subprocess.call('echo "RELEASE = \'"`git rev-parse --short HEAD`"\'" > release_hash.py', shell=True)
   
   from release import release
   rel = release()
   
   os.chdir(settings.FRONT_ROOT)
   
   dirs = []
   files = []
   for item in os.listdir():
     if os.path.isdir(item):
       rp = os.path.join(item, 'release.txt')
       if item != 'static' and not os.path.exists(rp):
         dirs.append(item)
         
     else:
       files.append(item)
       
   deploy_dir = os.path.join(settings.FRONT_ROOT, slug, 'app-{}'.format(rel))
   if not os.path.exists(deploy_dir):
     os.makedirs(deploy_dir)
     
   for file in files:
     subprocess.call("cp -v {} {}".format(file, deploy_dir), shell=True)
     
   for d in dirs:
     subprocess.call("cp -rv {} {}".format(d, deploy_dir), shell=True)
     
   less = os.path.join(deploy_dir, 'css', 'pytx')
   subprocess.call("lessc {}.less {}.css".format(less, less), shell=True)
   
   html = index_generator(slug, dev=False)
   indexes = (
     os.path.join(deploy_dir, 'index.html'),
     os.path.join(settings.FRONT_ROOT, slug, 'index.html'),
   )
   
   for index in indexes:
     fh = open(index, 'w')
     fh.write(html)
     fh.close()
     
   for file in ('logo144.png', 'offline.html', 'manifest.json'):
     cp = os.path.join(settings.FRONT_ROOT, slug, file)
     subprocess.call("cp -v {} {}".format(file, cp), shell=True)
     
   gen_path = os.path.join(deploy_dir, 'generated')
   subprocess.call("date > {}".format(gen_path), shell=True)
   
   release_path = os.path.join(settings.FRONT_ROOT, slug, 'release.txt')
   subprocess.call("echo '{}' > {}".format(rel, release_path), shell=True)
   
Example #8
0
def index_generator (conf_slug=settings.DEFAULT_CONF, dev=False):
  template = render_to_string('prebuild-index.html', {})
  
  context = dict(
    base='/{}/app-{}'.format(conf_slug, release()),
    conf=conf_slug,
    api_base='/',
    release=release(),
    app_base='app-{}'.format(release()),
  )
  
  html = Template(template).safe_substitute(context)
  pattern = '<!--dev-->(.*?)<!--dev-end-->'
  if dev:
    pattern = '<!--prod-->(.*?)<!--prod-end-->'
    
  html = re.sub(pattern, '', html, flags=re.S)
  return html
  
Example #9
0
    async def _library_release(self, command_args):
        """Do a library release"""
        repo_info = command_args.repo_info
        version = command_args.args[0]
        repo_url = repo_info.repo_url
        channel_id = repo_info.channel_id

        release(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            new_version=version,
        )

        org, repo = get_org_and_repo(repo_url)
        status = await wait_for_travis(
            github_access_token=self.github_access_token,
            org=org,
            repo=repo,
            branch="release-candidate",
        )
        if status != TRAVIS_SUCCESS:
            await self.say(
                channel_id=channel_id,
                text="Uh-oh, it looks like, uh, coffee break's over. During the release Travis had a {}.".format(
                    status,
                )
            )
            return

        finish_release(
            github_access_token=self.github_access_token,
            repo_url=repo_url,
            version=version,
            timezone=self.timezone
        )
        await self.say(
            channel_id=channel_id,
            text="My evil scheme {version} for {project} has been merged!".format(
                version=version,
                project=repo_info.name,
            )
        )
Example #10
0
def release(request):
    #获取前端传递过来的项目id和预发布注释内容
    #username = request.session.get('username','anybody')
    username = request.user.username
    id = str(request.POST.get('id', ''))
    comments = request.POST.get('comments', '')
    reobj = projectinfo.objects.get(id=id)

    from release import release
    result = release(comments, reobj, username)

    json_result = {'id': str(id), 'comments': comments, 'result': result}
    return HttpResponse(json.dumps(json_result, ensure_ascii=False))
Example #11
0
def index_generator(conf_slug=settings.DEFAULT_CONF, dev=False):
    template = render_to_string("prebuild-index.html", {})

    base = "/{}/app-{}".format(conf_slug, release())

    if dev:
        scripts = ""
        for script in SCRIPTS:
            scripts += '<script src="{}/{}"></script>\n'.format(base, script)

    else:
        scripts = '<script src="{}/compressed.js"></script>'.format(base)

    context = dict(
        base=base, conf=conf_slug, api_base="/", release=release(), app_base="app-{}".format(release()), scripts=scripts
    )

    html = Template(template).safe_substitute(context)
    pattern = "<!--dev-->(.*?)<!--dev-end-->"
    if dev:
        pattern = "<!--prod-->(.*?)<!--prod-end-->"

    html = re.sub(pattern, "", html, flags=re.S)
    return html
    def main(self, get_kcc_version):
        self.verify_bundle_name()

        # Read in the existing build info for the release
        logging.info("Loading release build info...")
        ktools_path = os.path.join(
            get_kcc_version.kcc_version().get_kcc_path(self.os_type), "bin")
        rel_binfo = download_build_info.build_info(self.build_dir,
                                                   self.build_name,
                                                   ktools_path,
                                                   self.kcs_output_dir)
        logging.info("DONE")

        # Get the build id from Kymera ELF
        self.build_id = rel_binfo.get_build_id()

        chip = chip_info.chip_info(rel_binfo.get_chipname())
        if chip.is_supported() == False:
            raise Exception("Chip NOT supported: " + str(chip.get_string()))

        try:
            os.chdir(self.kcsmaker_path)
            mod = imp.load_source("mod", self.bdl_file)
        except IOError:
            logging.error("Can't find file " + str(self.bdl_file))
            raise

        try:
            if len(mod.KDCs) > 0:
                logging.info("Building KCS " + str(self.bundle_name))
            else:
                logging.error("Error. No KDCs to be built")
                exit()
        except IOError:
            logging.error("Error. KDCs variable NOT found in " +
                          str(self.bdl_file))
            raise

        if self.linkscript_path == "":
            self.linkscript_path = os.path.join(
                self.kcsmaker_path, "templates",
                chip.get_linkscript_template_name())

        logging.info("DOWNLOAD_CONFIG = %s" % self.download_config)
        logging.info("RELEASE_FLAG = %s" % self.release_flag)
        logging.info("CAPABILITIES_PATH = %s" % self.capabilities_path)
        logging.info("KYMERA_SRC_PATH = %s" % self.kymera_src_path)
        logging.info("BUNDLE_NAME = %s" % self.bundle_name)
        logging.info("BUILD_DIR = %s" % self.build_dir)
        logging.info("PATCH_DIR = %s" % self.patch_dir)
        logging.info("BUILD_NAME = %s" % self.build_name)
        logging.info("BUILD_ROOT = %s" % self.build_root)
        logging.info("BUILD_ID = %s" % self.build_id)
        logging.info("KCS_OUTPUT_DIR = %s" % self.kcs_output_dir)
        logging.info("KCSMAKER_PATH = %s" % self.kcsmaker_path)
        logging.info("LINKSCRIPT_PATH = %s" % self.linkscript_path)
        logging.info("LABEL_NAME = %s" % self.label_name)

        kcsFileRoot = os.path.join(self.kcs_output_dir, "download", "debugbin",
                                   self.bundle_name)
        kcsFileT = kcsFileRoot + ".kcs"
        kcsFileB = kcsFileRoot + ".dkcs"
        kcsFileD = kcsFileRoot + ".kcs_DRAM"

        makeKCS = make_kcs.make_kcs(chip, self.build_id)

        logging.info("Generating KCS file " + kcsFileT + " ...")

        # Create output file if it doesn't exist
        if not os.path.exists(self.kcs_output_dir):
            os.makedirs(self.kcs_output_dir)

        # Check if we are building on the same bundle. If not then force a clean build
        if (os.path.exists(os.path.join(self.kcs_output_dir,
                                        "last_bundle.txt"))):
            last_bundle_file = open(
                os.path.join(self.kcs_output_dir, "last_bundle.txt"), "r")
            prev_bundle = last_bundle_file.readline()
            if prev_bundle != self.bundle_name:
                self.clean_build = True
                logging.info(
                    "Previous build detected: {prev_build}, now building: {cur_build}. \
                    Forcing clean build".format(prev_build=prev_bundle,
                                                cur_build=self.bundle_name))
            last_bundle_file.close()
        else:
            self.clean_build = True

        if self.clean_build == None:
            self.clean_build = self.release_flag

        kdc_count = 1
        for kdc_name in mod.KDCs.keys():
            logging.info("Generating KDC " + kdc_name)
            logging.info("Building " + str(mod.KDCs[kdc_name]) +
                         " capabilities ...")
            cap_list = []
            for cap_tuple in mod.KDCs[kdc_name]:
                cap_list.append(
                    capability.Capability(cap_tuple[0], cap_tuple[1],
                                          cap_tuple[2], cap_tuple[3],
                                          self.capabilities_path))

            # Build the elf and object files for each capability
            # Create a Build_Controller object to control the process

            if self.clean_build:
                # If Make sure the KDC file is created with an empty output directory
                for dir_or_file in os.listdir(self.kcs_output_dir):
                    dir_or_file_abs = os.path.join(self.kcs_output_dir,
                                                   dir_or_file)
                    if os.path.isdir(dir_or_file_abs):
                        # Don't delete this temp directory used to store kmap files
                        if dir_or_file != "kmap_tmp":
                            shutil.rmtree(dir_or_file_abs)
                    else:
                        # It's a file, remove it
                        os.remove(dir_or_file_abs)

            # Write current bundle into a file
            last_bundle_file = open(
                os.path.join(self.kcs_output_dir, "last_bundle.txt"), "w")
            last_bundle_file.write(self.bundle_name)
            last_bundle_file.close()

            if self.make_jobs is None:
                self.make_jobs = True

            build = build_controller.Build_Controller(
                self.build_root, self.build_dir, self.kcs_output_dir,
                self.kcsmaker_path, self.download_config,
                rel_binfo.get_elf_name(), self.extra_include, self.build_name,
                self.kymera_src_path, self.os_type, self.patch_dir)
            build.build(rel_binfo, cap_list, kdc_name, self.linkscript_path,
                        self.make_path, self.clean_build, self.make_jobs)

            logging.info(
                str(mod.KDCs[kdc_name]) + " capabilities successfully built.")

            # Copy kmap file to temp folder (it will get deleted on next KDC build)
            if not os.path.exists(os.path.join(self.kcs_output_dir,
                                               "kmap_tmp")):
                os.makedirs(os.path.join(self.kcs_output_dir, "kmap_tmp"))

            shutil.copy(
                os.path.join(self.kcs_output_dir, "download", "debugbin",
                             kdc_name + ".kmap"),
                os.path.join(self.kcs_output_dir, "kmap_tmp",
                             kdc_name + "(KDC).kmap"))

            objDumpPath = os.path.join(
                get_kcc_version.kcc_version().get_kcc_path(self.os_type),
                "bin", "kobjdump")

            oFiles = self.get_obj_files(chip, get_kcc_version)
            logging.info("oFiles" + str(oFiles))
            self.check_lib_release_files(oFiles)

            dnldElfFile = os.path.join(self.kcs_output_dir, "download",
                                       "debugbin", kdc_name + ".elf")
            mapOutFile = os.path.join(self.kcs_output_dir, "download",
                                      "debugbin", "map_out.txt")

            makeKDC = make_kdc.make_kdc(dnldElfFile, rel_binfo.get_elf_name(),
                                        chip, objDumpPath, oFiles, cap_list,
                                        self.os_type, mapOutFile)

            kdc = makeKDC.generateKDC(kdc_count, rel_binfo.get_rom_kalaccess())
            print(("Sizes for KDC {}:".format(dnldElfFile)))
            kdc.print_memory_usage()
            makeKCS.addKDC(kdc)
            kdc_count = kdc_count + 1

        # Copy kmap files to the output folder where the KCS files are
        files = glob.iglob(
            os.path.join(self.kcs_output_dir, "kmap_tmp", "*.kmap"))
        for file in files:
            if os.path.isfile(file):
                debugbin_dir = os.path.join(self.kcs_output_dir, "download",
                                            "debugbin")

                if self.clean_build:
                    shutil.move(file, debugbin_dir)
                else:
                    shutil.copy(file, debugbin_dir)

        if self.clean_build:
            os.rmdir(os.path.join(self.kcs_output_dir, "kmap_tmp"))

        kcs = makeKCS.generateKCS()
        kcs.dumpToTextFile(kcsFileT)
        kcs.dumpToBinaryFile(kcsFileB)
        kcs.dumpToDRAMFile(kcsFileD)

        if self.release_flag:

            import release

            this_rel = release.release(self.release_flag, self.kcsmaker_path,
                                       self.build_id, self.bundle_name,
                                       self.download_config, self.user)

            release.get_lock()

            # Generate new release ID
            this_rel.generate_new_version_id()
            self.version_build_id = this_rel.get_version_id()
            logging.info("New BUILD ID: " + str(this_rel.get_version_id()))

            if self.kymera_src_id == "":
                self.kymera_src_id = self.get_base_build_id_from_kymera_src_path(
                )

            this_rel.create_log()
            label = this_rel.label()
            this_rel.write_log("Label for released code " + str(label))
            this_rel.write_log("Base Build ID\t" + str(self.kymera_src_id))
            this_rel.end_log()

            this_rel.archive_KCS(
                this_rel.obtain_product_name(self.download_config))

            release.release_lock()
        else:
            # Copy binaries to a common folder so they don't get erased when a new build is triggered
            if not os.path.exists(
                    os.path.join(self.kymera_src_path, "output_bundles",
                                 self.download_config, self.bundle_name)):
                os.makedirs(
                    os.path.join(self.kymera_src_path, "output_bundles",
                                 self.download_config, self.bundle_name))

            file_ext_list = [".dkcs", ".kcs", ".elf", ".kmap", ".lst", ".sym"]
            for file_ext in file_ext_list:
                shutil.copy(
                    os.path.join(self.kcs_output_dir, "download", "debugbin",
                                 self.bundle_name + file_ext),
                    os.path.join(self.kymera_src_path, "output_bundles",
                                 self.download_config, self.bundle_name,
                                 self.bundle_name + file_ext))

            print("Bundle built successfully and available at: " +
                  "{0}".format(
                      os.path.join(self.kymera_src_path, "output_bundles",
                                   self.download_config, self.bundle_name,
                                   self.bundle_name + ".dkcs")))
Example #13
0
 files = glob.iglob(os.path.join(KCS_OUTPUT_DIR, "kmap_tmp", "*.kmap"))
 for file in files:
     if os.path.isfile(file):
         if clean_build:
             shutil.move(file, os.path.join(KCS_OUTPUT_DIR,"download", "debugbin"))
         else:
             shutil.copy(file, os.path.join(KCS_OUTPUT_DIR,"download", "debugbin"))
 if clean_build:
     os.rmdir(os.path.join(KCS_OUTPUT_DIR,"kmap_tmp"))
 kcs = makeKCS.generateKCS()
 kcs.dumpToTextFile(kcsFileT)
 kcs.dumpToBinaryFile(kcsFileB)
 kcs.dumpToDRAMFile(kcsFileD)
 if RELEASE_FLAG:
     import release
     this_rel = release.release(RELEASE_FLAG, KCSMAKER_PATH, BUILD_ID, BUNDLE_NAME, DOWNLOAD_CONFIG)
     # Generate new release ID
     this_rel.generate_new_version_id()
     logging.info("New BUILD ID: " + str(this_rel.get_version_id()))
     this_rel.create_log()
     label = this_rel.label()
     this_rel.write_log("Label for released code " + str(label))
     this_rel.archive_KCS()
 else:
     # Copy binaries to a common folder so they don't get erased when a new build is triggered
     if not os.path.exists(os.path.join(KYMERA_SRC_PATH,"output_bundles", DOWNLOAD_CONFIG, BUNDLE_NAME)):
         os.makedirs(os.path.join(KYMERA_SRC_PATH,"output_bundles",DOWNLOAD_CONFIG, BUNDLE_NAME))
     file_ext_list = [".dkcs",".kcs", ".elf", ".kmap", ".lst", ".sym"]
     for file_ext in file_ext_list:
         shutil.copy(os.path.join(KCS_OUTPUT_DIR,"download", "debugbin",BUNDLE_NAME + file_ext),os.path.join(KYMERA_SRC_PATH,"output_bundles",DOWNLOAD_CONFIG, BUNDLE_NAME,BUNDLE_NAME+file_ext))
     
Example #14
0
import datetime

import release

RELEASE = release.release()

from bunch import Bunch

from django.shortcuts import get_object_or_404
from django.db.models import Q
from django.utils import timezone
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.cache import cache_page
from django.conf import settings

import requests

from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permissions import AllowAny, IsAuthenticated

from twospaces.conference.models import Session, Conference, SponsorshipLevel
from twospaces.conference.serializers import ProposedReadSizzler, \
  SessionSizzler, ConferenceReadSizzler, SponsorshipLevelSizzler, \
  SessionScheduleSizzler, SessionPyVideoSizzler


@api_view(['GET'])
@permission_classes((AllowAny,))
def proposed_talks(request):
  talks = []
Example #15
0
def search_clever (tr):
	sFktname = "search_clever"
	
	# build search-term
	if tr.artist != "" and tr.title != "":
		term = tr.artist + "+" + tr.title
		term = term.replace("&","")
		term = term.replace("(","")
		term = term.replace(")","")

		term = term.replace(" ","+")
	
	# first try to find the track in the release
	# cache
	if len(cache.rels_found) > 0:
		for rel in cache.rels_found:

			ePrint(1, sFktname, "search in cache")

			# search track in release
			res = rel.search_track(tr)

			# nothing found
			if res == None:
				continue

			# more than one item found
			if len(res) > 1:
				ePrint(1, sFktname, "Multiple tracks found in release, make a choice")
				k = 0
				for t in res:
					print("{0:3d}:\t{1}".format(k , t))
					k = k + 1
				print("\n")
				choice = int(input(" <-- "))
				res = res[choice]
				return res

			return res[0]

	ePrint(1, sFktname, "search the web")

	# search on chemical
	query_chemical = chemical.chemical()
	results = query_chemical.search(term)

	# case if nothing was found
	if len(results) == 0:
		ePrint(1, sFktname, "nothing found on chemical")
		return None

	# case, if more then one was found
	if len(results) > 1:
		ePrint(1, sFktname, "Multiple Links found. Make a Choice\n")
		k = 0
		for i in results:
			print("{0:3d}:\t{1}".format(k , results[k][1]))
			k = k + 1
		print("\n")
		choice = int(input(" <-- "))
		results = [ [ results[choice][0], results[choice][1] ] ]
	
	# create an release instance and feed it
	rel = release()
	rel.shortinfo = results[0][1]
	rel.infopage = results[0][0]
	rel = query_chemical.getReleaseInfo(rel)

	# append the release to the cache
	cache.rels_found.append(rel)

	# search track in release
	res = rel.search_track(tr)

	# nothing found
	if res == None:
		ePrint(1, sFktname, "Track not found in release page")
		return None

	# more than one item found
	if len(res) > 1:
		ePrint(1, sFktname, "Multible tracks found in release, make a choice")
		k = 0
		for t in res:
			print("{0:3d}:\t{1}".format(k , t))
			k = k + 1
		print("\n")
		choice = int(input(" <-- "))
		res = res[choice]
	
	return res[0]
Example #16
0
import datetime

import release

RELEASE = release.release()

from bunch import Bunch

from django.shortcuts import get_object_or_404
from django.db.models import Q
from django.utils import timezone
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.cache import cache_page
from django.conf import settings

import requests

from rest_framework.decorators import api_view, permission_classes
from rest_framework.response import Response
from rest_framework.permissions import AllowAny, IsAuthenticated

from twospaces.conference.models import Session, Conference, SponsorshipLevel
from twospaces.conference.serializers import ProposedReadSizzler, \
  SessionSizzler, ConferenceReadSizzler, SponsorshipLevelSizzler, \
  SessionScheduleSizzler, SessionPyVideoSizzler


@api_view(['GET'])
@permission_classes((AllowAny, ))
def proposed_talks(request):
    talks = []
Example #17
0
# coding=utf-8
from release import release, versionCodePlusPlus
import os
import shutil


FLAVOR_FILE = 'all_channels.txt'
if __name__ == '__main__':
    if os.path.exists("release_apks"):
        shutil.rmtree("release_apks")
        print "delete exist release_apks success"
    if os.path.exists("app/build"):
        shutil.rmtree("app/build")
    print "delete exist release_apks success"
    os.mkdir("release_apks")


    versionCodePlusPlus('middle')
    release('middle')
    versionCodePlusPlus('long')
    release('long')
    versionCodePlusPlus('short')
    release('short')