def handle_noargs(self, **options): self.logger = logging.getLogger('collectreqs') self.logger.setLevel(logging.INFO) console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(logging.Formatter('%(message)s')) self.logger.addHandler(console) # HACK: we expect the test cases to spout warnings, don't want the user to see them and get upset if os.environ.has_key('TEST_SUPPRESS_STDERR'): console.setLevel(logging.ERROR) siteDir = commandUtil.getSiteDir() self.logger.debug('siteDir: %s' % siteDir) outName = '%s/build/management/allRequirements.txt' % siteDir subReqFileList = ( glob('%ssubmodules/*/requirements.txt' % siteDir) + glob('%sapps/*/management/requirements.txt' % siteDir) + glob('%smanagement/siteRequirements.txt' % siteDir)) builder = Builder() builder.applyRule(outName, subReqFileList, lambda: self.collect(outName, subReqFileList))
def handle(self, *args, **options): _d = os.path.dirname appDir = _d(_d(_d(os.path.abspath(__file__)))) b = Builder() self.generateNotebookDir(b, appDir) b.finish()
def handle(self, *args, **options): siteDir = commandUtil.getSiteDir() builder = Builder() context = dict(((k, getattr(settings, k)) for k in dir(settings) if not k.startswith("_"))) context.update(dict(USER=os.getenv("USER"))) srcs = glob("%smanagement/preptemplates/*" % siteDir) for src in srcs: dst = "%sbuild/preptemplates/%s" % (siteDir, os.path.basename(src)) builder.applyRule(dst, [src], lambda: fillTemplate(src, dst, context))
def handle_noargs(self, **options): siteDir = commandUtil.getSiteDir() builder = Builder() context = dict(((k, getattr(settings, k)) for k in dir(settings) if not k.startswith('_'))) context.update(dict(USER=os.environ['USER'])) srcs = glob('%smanagement/preptemplates/*' % siteDir) for src in srcs: dst = '%sbuild/preptemplates/%s' % (siteDir, os.path.basename(src)) builder.applyRule(dst, [src], lambda: fillTemplate(src, dst, context))
def __init__(self, builder=None, logger=None): if builder is None: builder = Builder() if logger is None: logger = logging self.builder = builder self.logger = logger
def handle_noargs(self, **options): up = os.path.dirname appDir = up(up(up(os.path.abspath(__file__)))) print 'appDir:', appDir builder = Builder() # render svg to png if settings.GEOCAM_LENS_RENDER_SVG_ICONS: svgGlob = '%s/media_src/icons/*.svg' % appDir svgOutput = '%s/build/media/geocamLens/icons/map/' % appDir logging.debug('svgIcons %s %s' % (svgGlob, svgOutput)) for imPath in glob(svgGlob): svg.buildIcon(builder, imPath, outputDir=svgOutput) # link static stuff into build/media inst = Installer(builder) inst.installRecurseGlob('%s/static/*' % appDir, '%s/build/media' % appDir) # rotate pngs rotGlob = '%s/build/media/geocamLens/icons/map/*Point.png' % appDir rotOutput = '%s/build/media/geocamLens/icons/mapr' % appDir logging.debug('rotateIcons %s %s' % (rotGlob, rotOutput)) for imPath in glob(rotGlob): rotate.buildAllDirections(builder, imPath, outputDir=rotOutput)
def handle(self, *args, **options): up = os.path.dirname appDir = up(up(up(os.path.abspath(__file__)))) print 'appDir:', appDir builder = Builder() # render svg to png svgOutput = '%s/build/static/geocamLens/icons/map/' % appDir if settings.GEOCAM_LENS_RENDER_SVG_ICONS: svgGlob = '%s/media_src/icons/*.svg' % appDir logging.debug('svgIcons %s %s', svgGlob, svgOutput) for imPath in glob(svgGlob): svg.buildIcon(builder, imPath, outputDir=svgOutput) # link static stuff into build/media inst = Installer(builder) inst.installRecurseGlob('%s/static/*' % appDir, '%s/build/static' % appDir) # make highlighted versions of icons dstGlob = svgOutput + '*.png' logging.debug('highlightIcons %s', dstGlob) for dst in glob(dstGlob): if 'Highlighted' in dst: continue dstHighlighted = os.path.splitext(dst)[0] + 'Highlighted.png' halo.addHalo(builder, dst, dstHighlighted) # rotate pngs rotGlob = '%s/build/static/geocamLens/icons/map/*Point*.png' % appDir rotOutput = '%s/build/static/geocamLens/icons/mapr' % appDir logging.debug('rotateIcons %s %s', rotGlob, rotOutput) for imPath in glob(rotGlob): rotate.buildAllDirections(builder, imPath, outputDir=rotOutput)
def test_buildIcon(self): thisDir = os.path.dirname(os.path.abspath(__file__)) srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir) builder = Builder() logging.debug('buildIcon srcImage=%s outDir=%s', srcImage, self.outDir) svg.buildIcon(builder, srcImage, outputDir=self.outDir) self.assertExists('%sexample.png' % self.outDir) self.assertExists('%sexamplePoint.png' % self.outDir)
def test_buildAllDirections(self): thisDir = os.path.dirname(os.path.abspath(__file__)) srcImage = '%s/media_src/icons/example.png' % os.path.dirname(thisDir) builder = Builder() logging.debug('buildAllDirections srcImage=%s outDir=%s' % (srcImage, self.outDir)) rotate.buildAllDirections(builder, srcImage, self.outDir) self.assertExists('%sexample000.png' % self.outDir) self.assertExists('%sexample180.png' % self.outDir) self.assertExists('%sexample350.png' % self.outDir)
def handle_noargs(self, **options): self.logger = logging.getLogger('collectreqs') self.logger.setLevel(logging.INFO) console = logging.StreamHandler() console.setLevel(logging.INFO) console.setFormatter(logging.Formatter('%(message)s')) self.logger.addHandler(console) # HACK: we expect the test cases to spout warnings, don't want the user to see them and get upset if os.environ.has_key('TEST_SUPPRESS_STDERR'): console.setLevel(logging.ERROR) siteDir = commandUtil.getSiteDir() self.logger.debug('siteDir: %s' % siteDir) outName = '%s/build/management/allRequirements.txt' % siteDir subReqFileList = (glob('%ssubmodules/*/requirements.txt' % siteDir) + glob('%sapps/*/management/requirements.txt' % siteDir) + glob('%smanagement/siteRequirements.txt' % siteDir)) builder = Builder() builder.applyRule(outName, subReqFileList, lambda: self.collect(outName, subReqFileList))
def handle_noargs(self, **options): up = os.path.dirname appDir = up(up(up(os.path.abspath(__file__)))) builder = Builder() # minify javascript files into geocamAwareMin.js srcDir = '%s/static/' % appDir srcPairs = [(srcDir + suffix, doMinify) for suffix, doMinify in JS_MODULES] minifyJs(builder, '%s/build/static/geocamAware/js/geocamAwareMin.js' % appDir, srcPairs) # link static stuff into build/static inst = Installer(builder) inst.installRecurseGlob('%s/static/*' % appDir, '%s/build/static' % appDir)
def test_buildIcon(self): thisDir = os.path.dirname(os.path.abspath(__file__)) srcImage = '%s/media_src/icons/example.svg' % os.path.dirname(thisDir) builder = Builder() logging.debug('buildIcon srcImage=%s outDir=%s', srcImage, self.outDir) try: svg.buildIcon(builder, srcImage, outputDir=self.outDir) except svg.NoSvgBackendError: logging.warning('no svg rendering backend found') logging.warning( 'in order to run svg rendering tests, try installing ImageMagick or rsvg' ) logging.warning( 'note: this may be ok; svg rendering may not be needed for your site' ) return self.assertExists('%sexample.png' % self.outDir) self.assertExists('%sexamplePoint.png' % self.outDir)
def main(): import optparse parser = optparse.OptionParser('usage: %prog <in.png> <out.png>') parser.add_option( '-w', '--width', type=float, default=DEFAULT_HALO_WIDTH, help='Width of halo as a proportion of the image size (0..1) [%default]' ) opts, args = parser.parse_args() if len(args) != 2: parser.error('expected exactly 2 args') if not (0 < opts.width and opts.width < 1): parser.error('width must be in range 0..1') from geocamUtil.Builder import Builder builder = Builder() addHalo(builder, args[0], args[1], opts.width)
def compileXpjson(builder=None): if builder is None: builder = Builder() for platform, schemaDict in settings.XGDS_PLANNER_SCHEMAS.iteritems(): schema = models.PlanSchema(platform, schemaDict) doCompile(schema, builder)