def handleImportPaths(self, impPaths, options): inst = Installer() siteDir = commandUtil.getSiteDir() # make new-style static and media setup staticRoot = getattr(settings, 'STATIC_ROOT', '%sbuild/static' % siteDir) if not os.path.exists(staticRoot): os.makedirs(staticRoot) #if not os.path.exists(settings.MEDIA_ROOT): # mediaRootNoTrailingSlash = re.sub('/$', '', settings.MEDIA_ROOT) # os.symlink(staticRoot, mediaRootNoTrailingSlash) # install admin media djangoDir = os.path.dirname(os.path.realpath(django.__file__)) adminMediaDir = os.path.join(djangoDir, 'contrib', 'admin', 'media') inst.installRecurse(adminMediaDir, os.path.join(staticRoot, 'admin')) for impPath in impPaths: logging.debug('collectmedia app %s', impPath) appMod = __import__(impPath, fromlist=['dummy']) appPath = os.path.dirname(appMod.__file__) tryMediaPaths = [ '%s/build/static' % appPath, '%s/build/media' % appPath, # legacy support '%s/static' % appPath ] for mediaPath in tryMediaPaths: logging.debug('collectmedia app %s: checking for media in %s', impPath, mediaPath) if os.path.exists(mediaPath): inst.installRecurseGlob('%s/*' % mediaPath, '%sbuild/static' % siteDir) break
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 handleImportPaths(self, impPaths, options): inst = Installer() siteDir = commandUtil.getSiteDir() # make new-style static and media setup staticRoot = getattr(settings, 'STATIC_ROOT', '%sbuild/static' % siteDir) if not os.path.exists(staticRoot): os.makedirs(staticRoot) #if not os.path.exists(settings.MEDIA_ROOT): # mediaRootNoTrailingSlash = re.sub('/$', '', settings.MEDIA_ROOT) # os.symlink(staticRoot, mediaRootNoTrailingSlash) # install admin media djangoDir = os.path.dirname(os.path.realpath(django.__file__)) adminMediaDir = os.path.join(djangoDir, 'contrib', 'admin', 'media') inst.installRecurse(adminMediaDir, os.path.join(staticRoot, 'admin')) for impPath in impPaths: logging.debug('collectmedia app %s', impPath) appMod = __import__(impPath, fromlist=['dummy']) appPath = os.path.dirname(appMod.__file__) tryMediaPaths = ['%s/build/static' % appPath, '%s/build/media' % appPath, # legacy support '%s/static' % appPath] for mediaPath in tryMediaPaths: logging.debug('collectmedia app %s: checking for media in %s', impPath, mediaPath) if os.path.exists(mediaPath): inst.installRecurseGlob('%s/*' % mediaPath, '%sbuild/static' % siteDir) break
def handleImportPaths(self, impPaths, options): for impPath in impPaths: logging.debug('collectbinaries app %s', impPath) appMod = __import__(impPath, fromlist=['dummy']) appPath = os.path.dirname(appMod.__file__) binPath = '%s/bin' % appPath logging.debug('collectbinaries app %s: checking for binaries in %s', impPath, binPath) if os.path.exists(binPath): siteDir = commandUtil.getSiteDir() inst = Installer() inst.installRecurseGlob('%s/*' % binPath, '%sbuild/bin' % siteDir)
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 handle(self, *args, **options): from django.db import models if args: # user specified apps to prep impPaths = args else: # user did not specify, default to all apps in INSTALLED_APPS from django.conf import settings impPaths = settings.INSTALLED_APPS for impPath in impPaths: logging.debug('collectmedia app %s' % impPath) appMod = __import__(impPath, fromlist=['dummy']) appPath = os.path.dirname(appMod.__file__) tryMediaPaths = ['%s/build/media' % appPath, '%s/static' % appPath] for mediaPath in tryMediaPaths: logging.debug('collectmedia app %s: checking for media in %s' % (impPath, mediaPath)) if os.path.exists(mediaPath): siteDir = commandUtil.getSiteDir() inst = Installer() inst.installRecurseGlob('%s/*' % mediaPath, '%sbuild/media' % siteDir) break