Esempio n. 1
0
def make_release(options):
    """
    Creates a tarball to use for building the system elsewhere
    (production, distribution, etc)
    """

    # This part of the build is svn specific...

    if not hasattr(options, 'skip_packaging'):
        call_task("package_all")
    if hasattr(options, 'name'):
        pkgname = options.name
    else:
        pkgname = create_version_name()
        if hasattr(options, 'append_to'):
            pkgname += options.append_to

    with pushd('shared'):
        out_pkg = path(pkgname)
        out_pkg.rmtree()
        path('./package').copytree(out_pkg)

        tar = tarfile.open("%s.tar.gz" % out_pkg, "w:gz")
        with pushd(out_pkg):
            for file in path(".").walkfiles():
                tar.add(file)
        tar.close()

        out_pkg.rmtree()
        info("%s.tar.gz created" % out_pkg.abspath())
Esempio n. 2
0
def setup_geoserver(options):
    if not (path('src') / gs).exists():
        call_task('checkout_geoserver')
    with pushd('src'):
        with pushd(gs):
            sh('mvn install')
            sh("mvn install:install-file -DgroupId=org.geoserver -DartifactId=geoserver -Dversion=2.0-SNAPSHOT -Dpackaging=war -Dfile=web/app/target/geoserver.war")
        with pushd('geonode-geoserver-ext'):
            sh("mvn install")
Esempio n. 3
0
def host(options):
    jettylog = open("jetty.log", "w")
    djangolog = open("django.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommandFile=../../etc/hotspot_compiler",
            "-Djetty.host=" + options.host.bind,
            "-Xmx512M",
            "-XX:MaxPermSize=128m"
        ])
        mvn = subprocess.Popen(
            ["mvn", "jetty:run"],
            stdout=jettylog,
            stderr=jettylog
        )
    django = subprocess.Popen([
            "django-admin.py", 
            "runserver",
            "--settings=capra.settings",
            options.host.bind + ":8000"
        ],  
        stdout=djangolog,
        stderr=djangolog
    )

    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind + ":8001/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 4
0
def install_dependencies():
    """
    Installs required python packages.

    Only install if the requirements file changed.
    """
    requirements_file = 'requirements.txt'
    installed_file = 'requirements.installed'
    requirements = read_requirements(requirements_file)
    installed = os.path.exists(installed_file) and open(installed_file).read()
    if installed == requirements:
        print ('Nothing new to install. Delete %s if you want to try anyway' %
            installed_file)
    else:
        sh('pip install -r ' + requirements_file)

        # remember what was installed
        with open(installed_file, 'w+') as f:
            f.write(requirements)
    try:
        import geotrack
    except ImportError:
        # geotrack should probably have it's own repository.....
        with pushd('geotrack'):
            sh('python setup.py develop')
Esempio n. 5
0
def host(options):
    jettylog = open("jetty.log", "w")
    djangolog = open("django.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Djetty.host=" + options.host.bind,
            "-Xmx512M",
            "-XX:MaxPermSize=128m"
        ])
        mvn = subprocess.Popen(
            ["mvn", "jetty:run"],
            stdout=jettylog,
            stderr=jettylog
        )
    django = subprocess.Popen([
            "paster", 
            "serve",
            "--reload",
	        "shared/dev-paste.ini"
        ],  
        stdout=djangolog,
        stderr=djangolog
    )

    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind + ":8001/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 6
0
def concat_js(options):
    """Compress the JavaScript resources used by the base GeoNode site."""
    with pushd('src/geonode-client/build/'):
       path("geonode-client").rmtree()
       os.makedirs("geonode-client")
       path("../externals/ext").copytree("geonode-client/ext")
       os.makedirs("geonode-client/gx")
       path("../externals/geoext/geoext/resources").copytree("geonode-client/gx/theme")
       os.makedirs("geonode-client/gxp")
       path("../externals/gxp/src/theme").copytree("geonode-client/gxp/theme")
       os.makedirs("geonode-client/PrintPreview")
       path("../externals/PrintPreview/resources").copytree("geonode-client/PrintPreview/theme")
       os.makedirs("geonode-client/ol") #need to split this off b/c of dumb hard coded OL paths
       path("../externals/openlayers/theme").copytree("geonode-client/ol/theme")
       path("../externals/openlayers/img").copytree("geonode-client/ol/img")
       os.makedirs("geonode-client/gn")
       path("../src/theme/").copytree("geonode-client/gn/theme/")
       path("../src/script/ux").copytree("geonode-client/gn/ux")

       sh("jsbuild -o geonode-client/ all.cfg") 
       move("geonode-client/OpenLayers.js","geonode-client/ol/")
       move("geonode-client/GeoExt.js","geonode-client/gx/")
       move("geonode-client/gxp.js","geonode-client/gxp/")
       move("geonode-client/GeoNode.js","geonode-client/gn/")
       move("geonode-client/PrintPreview.js","geonode-client/PrintPreview/")
       move("geonode-client/ux.js","geonode-client/gn/")
Esempio n. 7
0
def build_js(options):
    """
    Concatenate and compress application client javascript
    """
    with pushd('src/geonode-client/build/'):
       path("geonode-client").rmtree()
       os.makedirs("geonode-client")
       path("../externals/ext").copytree("geonode-client/ext")
       os.makedirs("geonode-client/gx")
       path("../externals/geoext/geoext/resources").copytree("geonode-client/gx/theme")
       os.makedirs("geonode-client/gxp")
       path("../externals/gxp/src/theme").copytree("geonode-client/gxp/theme")
       os.makedirs("geonode-client/PrintPreview")
       path("../externals/PrintPreview/resources").copytree("geonode-client/PrintPreview/theme")
       os.makedirs("geonode-client/ol") #need to split this off b/c of dumb hard coded OL paths
       path("../externals/openlayers/theme").copytree("geonode-client/ol/theme")
       path("../externals/openlayers/img").copytree("geonode-client/ol/img")
       os.makedirs("geonode-client/gn")
       path("../src/theme/").copytree("geonode-client/gn/theme/")
       path("../src/script/ux").copytree("geonode-client/gn/ux")

       sh("jsbuild -o geonode-client/ all.cfg") 
       move("geonode-client/OpenLayers.js","geonode-client/ol/")
       move("geonode-client/GeoExt.js","geonode-client/gx/")
       move("geonode-client/gxp.js","geonode-client/gxp/")
       move("geonode-client/GeoNode.js","geonode-client/gn/")
       move("geonode-client/GeoExplorer.js","geonode-client/gn/")
       move("geonode-client/PrintPreview.js","geonode-client/PrintPreview/")
       move("geonode-client/ux.js","geonode-client/gn/")
       
    info('GeoNode Client Javascript is done building')
Esempio n. 8
0
def host(options):
    jettylog = open("jetty.log", "w")
    djangolog = open("django.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            #"-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8020,server=y,suspend=y",
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Djetty.host=" + options.host.bind,
            "-Xmx512M",
            "-XX:MaxPermSize=256m"
        ])
        mvn = subprocess.Popen(["mvn", "jetty:run"],
                               stdout=jettylog,
                               stderr=jettylog)
    django = subprocess.Popen(
        ["paster", "serve", "--reload", "shared/dev-paste.ini"],
        stdout=djangolog,
        stderr=djangolog)

    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind +
                           ":8080/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 9
0
def host(options):
    jettylog = open("jetty.log", "w")
    djangolog = open("django.log", "w")
    from geonode import settings

    url = "http://localhost:8080/geoserver/"
    if settings.GEOSERVER_BASE_URL != url:
        print 'your GEOSERVER_BASE_URL does not match %s' % url
        sys.exit(1)

    jettylog = open("jetty.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Xmx512M", "-XX:MaxPermSize=256m"
        ])
        mvn = subprocess.Popen(["mvn", "jetty:run"],
                               stdout=jettylog,
                               stderr=jettylog)

    socket.setdefaulttimeout(1)
    django = subprocess.Popen(
        ["paster", "serve", "--reload", "shared/dev-paste.ini"],
        stdout=djangolog,
        stderr=djangolog)

    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind +
                           ":8080/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 10
0
def make_release(options):
    """
    Creates a tarball to use for building the system elsewhere
    (production, distribution, etc)
    """

    if not hasattr(options, "skip_packaging"):
        call_task("package_all")
    if hasattr(options, "name"):
        pkgname = options.name
    else:
        pkgname = create_version_name()
        if hasattr(options, "append_to"):
            pkgname += options.append_to

    with pushd("shared"):
        out_pkg = path(pkgname)
        out_pkg.rmtree()
        path("./package").copytree(out_pkg)

        tar = tarfile.open("%s.tar.gz" % out_pkg, "w:gz")
        for file in out_pkg.walkfiles():
            tar.add(file)
        tar.close()

        out_pkg.rmtree()
        info("%s.tar.gz created" % out_pkg.abspath())
Esempio n. 11
0
def make_release(options):
    """
    Creates a tarball to use for building the system elsewhere
    (production, distribution, etc)
    """

    if not hasattr(options, 'skip_packaging'):
        call_task("package_all")
    if hasattr(options, 'name'):
        pkgname = options.name
    else:
        pkgname = create_version_name()
        if hasattr(options, 'append_to'):
            pkgname += options.append_to

    with pushd('shared'):
        out_pkg = path(pkgname)
        out_pkg.rmtree()
        path('./package').copytree(out_pkg)

        tar = tarfile.open("%s.tar.gz" % out_pkg, "w:gz")
        for file in out_pkg.walkfiles():
            tar.add(file)
        tar.add('../README.release.rst', arcname=('%s/README.rst' % out_pkg))
        tar.close()

        out_pkg.rmtree()
        info("%s.tar.gz created" % out_pkg.abspath())
Esempio n. 12
0
def start_geoserver(options):
    from django.conf import settings
    
    url = "http://localhost:8080/geoserver/"
    if settings.GEOSERVER_BASE_URL != url:
        print 'your GEOSERVER_BASE_URL does not match %s' % url
        sys.exit(1)
	
	
    jettylog = open("jetty.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Xmx512M",
            "-XX:MaxPermSize=256m"
        ])
        mvn = subprocess.Popen(
            ["mvn", "jetty:run"],
            stdout=jettylog,
            stderr=jettylog
        )


    socket.setdefaulttimeout(1)

    info("Logging servlet output to jetty.log...")
    info("Jetty is starting up, please wait...")
    waitfor(settings.GEOSERVER_BASE_URL)
    info("Development GeoServer/GeoNetwork is running")
    sh('python manage.py updatelayers') 
Esempio n. 13
0
def start_geoserver(options):
    jettylog = open("jetty.log", "w")
    from geonode import settings

    url = "http://localhost:8080/geoserver/"
    if settings.GEOSERVER_BASE_URL != url:
        print 'your GEOSERVER_BASE_URL does not match %s' % url
        sys.exit(1)


    jettylog = open("jetty.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Xmx512M",
            "-XX:MaxPermSize=256m"
        ])
        mvn = subprocess.Popen(
            ["mvn", "jetty:run"],
            stdout=jettylog,
            stderr=jettylog
        )


    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind + ":8080/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 14
0
def package_webapp(options):
    """Package (Python, Django) web application and dependencies."""
    with pushd('src/GeoNodePy'):
        sh('python setup.py egg_info sdist')
        
    req_file = options.deploy.req_file
    req_file.write_text(deploy_req_txt)
    pip_bundle("-r %s %s/geonode-webapp.pybundle" % (req_file, options.deploy.out_dir))
Esempio n. 15
0
def package_client(options):
    """
    Package compressed client resources (JavaScript, CSS, images).
    """
    # build_dir = options.deploy.out_dir
    zip = zipfile.ZipFile(geonode_client_target(),'w') #create zip in write mode

    with pushd('src/geonode-client/build/'):
        for file in path("geonode-client/").walkfiles():
            print(file)
            zip.write(file)
    
    with pushd('src/capra-client/build/'):
        for file in path("capra-client/").walkfiles():
            print(file)
            zip.write(file)

    zip.close()
Esempio n. 16
0
def package_webapp(options):
    """Package (Python, Django) web application and dependencies."""
    with pushd('src/GeoNodePy'):
        sh('python setup.py egg_info sdist')

    req_file = options.deploy.req_file
    req_file.write_text(deploy_req_txt)
    pip_bundle("-r %s %s/geonode-webapp.pybundle" %
               (req_file, options.deploy.out_dir))
Esempio n. 17
0
def download_bundle(options):
    """
    Downloads zipped bundle of python dependencies to %s. Does not overwrite.
    """ % bundle
    
    bpath = bundle.abspath()
    if not bundle.exists():
        with pushd('shared'):
            grab("http://dev.capra.opengeo.org/repo/%s.zip" % dlname, bpath)
    else:
        info("Skipping download. 'rm bundle  %s' if you need a fresh download. " % bundle)
Esempio n. 18
0
def setup_geonode_client(options):
    """
    Fetch geonode-client
    """
    static = path("./src/GeoNodePy/geonode/static/geonode")

    with pushd("src/geonode-client/"):
        sh("mvn clean compile")

    src_zip = "src/geonode-client/build/geonode-client.zip"
    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 19
0
def setup_geonode_client(options):
    """
    Fetch geonode-client
    """
    static = path("./src/GeoNodePy/geonode/static/geonode")

    with pushd("src/geonode-client/"):
        sh("mvn clean compile")
    
    src_zip = "src/geonode-client/build/geonode-client.zip"
    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 20
0
def package_webapp(options):

    sh("django-admin.py collectstatic -v0 --settings=geonode.settings --noinput")

    """Package (Python, Django) web application and dependencies."""
    with pushd('src/GeoNodePy'):
        sh('python setup.py egg_info sdist')

    req_file = options.deploy.req_file
    req_file.write_text(deploy_req_txt)
    pip_bundle("-r %s %s/geonode-webapp.pybundle" % (req_file, options.deploy.out_dir))
Esempio n. 21
0
def package_webapp(options):

    sh("django-admin.py collectstatic -v0 --settings=geonode.settings --noinput"
       )
    """Package (Python, Django) web application and dependencies."""
    with pushd('src/GeoNodePy'):
        sh('python setup.py egg_info sdist')

    req_file = options.deploy.req_file
    req_file.write_text(deploy_req_txt)
    pip_bundle("-r %s %s/geonode-webapp.pybundle" %
               (req_file, options.deploy.out_dir))
Esempio n. 22
0
def download_bundle(options):
    """
    Downloads zipped bundle of python dependencies to %s. Does not overwrite.
    """ % bundle

    bpath = bundle.abspath()
    if not bundle.exists():
        with pushd('shared'):
            grab("http://dev.capra.opengeo.org/repo/%s.zip" % dlname, bpath)
    else:
        info(
            "Skipping download. 'rm bundle  %s' if you need a fresh download. "
            % bundle)
Esempio n. 23
0
def setup_geonode_client(options):
    """
    Build geonode-client
    """
    with pushd('src/geonode-client'):
        sh("mvn clean install")

    static = path("./src/GeoNodePy/geonode/media/static")
    if not static.exists():
        static.mkdir()

    src_zip = path("./src/geonode-client/build/geonode-client.zip")

    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 24
0
def setup_geonode_client(options):
    """
    Build geonode-client
    """
    with pushd('src/geonode-client'):
        sh("mvn clean install")
    
    static = path("./src/GeoNodePy/geonode/media/static")
    if not static.exists():
        static.mkdir()

    src_zip = path("./src/geonode-client/build/geonode-client.zip")

    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 25
0
def setup_geonode_client(options):
    """
    Fetch geonode-client
    """
    static = path("./src/GeoNodePy/geonode/media/static")
    if not static.exists():
        static.mkdir()

    sh("git submodule update --init")

    with pushd("src/geonode-client/"):
        sh("mvn clean compile")
    
    src_zip = "src/geonode-client/build/geonode-client.zip"
    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 26
0
def setup_geonode_client(options):
    """
    Fetch geonode-client
    """
    static = path("./src/GeoNodePy/geonode/static/geonode")
    if not static.exists():
        static.mkdir()

    sh("git submodule update --init")

    with pushd("src/geonode-client/"):
        sh("ant clean zip")

    src_zip = "src/geonode-client/build/geonode-client.zip"
    zip_extractall(zipfile.ZipFile(src_zip), static)
Esempio n. 27
0
def start_geoserver(options):
    jettylog = open("jetty.log", "w")
    with pushd("src/geoserver-geonode-ext"):
        os.environ["MAVEN_OPTS"] = " ".join([
            "-XX:CompileCommand=exclude,net/sf/saxon/event/ReceivingContentHandler.startElement",
            "-Djetty.host=" + options.host.bind,
            "-Xmx512M",
            "-XX:MaxPermSize=256m"
            #"-Xdebug -Xrunjdwp:transport= dt_socket,address=8020,server=y,suspend=n"
        ])
        mvn = subprocess.Popen(
            ["mvn", "jetty:run"],
            stdout=jettylog,
            stderr=jettylog
        )


    def jetty_is_up():
        try:
            urllib.urlopen("http://" + options.host.bind + ":8080/geoserver/web/")
            return True
        except Exception, e:
            return False
Esempio n. 28
0
def build_docs():
    doctools.doc_clean()
    doctools.html()
    # also build docs for Geotrack
    with pushd('geotrack/docs'):
        sh('make clean && make html')
Esempio n. 29
0
def package(options):
    """
    Creates a tarball to use for building the system elsewhere
    """
    import pkg_resources
    import tarfile
    import geonode

    version = geonode.get_version()
    # Use WorldMap's version for the package name.
    pkgname = 'worldmap-%s-all' % version

    # Create the output directory.
    out_pkg = path(pkgname)
    out_pkg_tar = path("%s.tar.gz" % pkgname)

    # Create a distribution in zip format for the WorldMap python package.
    dist_dir = path('dist')
    dist_dir.rmtree()
    sh('python setup.py sdist --formats=zip')

    with pushd('package'):

        #Delete old tar files in that directory
        for f in glob.glob('worldmap*.tar.gz'):
            old_package = path(f)
            if old_package != out_pkg_tar:
                old_package.remove()

        if out_pkg_tar.exists():
            info('There is already a package for version %s' % version)
            return

        # Clean anything that is in the oupout package tree.
        out_pkg.rmtree()
        out_pkg.makedirs()

        support_folder = path('support')
        install_file = path('install.sh')

        # And copy the default files from the package folder.
        justcopy(support_folder, out_pkg / 'support')
        justcopy(install_file, out_pkg)

        geonode_dist = path('..') / 'dist' / 'worldmap-%s.zip' % version
        justcopy(geonode_dist, out_pkg)

        # Create a tar file with all files in the output package folder.
        tar = tarfile.open(out_pkg_tar, "w:gz")
        for file in out_pkg.walkfiles():
            tar.add(file)

        # Add the README with the license and important links to documentation.
        #tar.add('README.rst', arcname=('%s/README.rst' % out_pkg))
        tar.close()

        # Remove all the files in the temporary output package directory.
        out_pkg.rmtree()

    # Report the info about the new package.
    info("%s created" % out_pkg_tar.abspath())
Esempio n. 30
0
def setup_geoserver(options):
    """Prepare a testing instance of GeoServer."""
    with pushd('src/geoserver-geonode-ext'):
        sh("mvn clean install")
Esempio n. 31
0
def capra_js(options):
    """Compress the JavaScript resources used by the CAPRA GeoNode extensions."""
    with pushd('src/capra-client/build/'):
       path("capra-client").rmtree()
       path("capra-client/").makedirs()
       sh("jsbuild -o capra-client/ all.cfg") 
Esempio n. 32
0
def checkout_geoserver(options):
    with pushd('src'):
        svn.checkout("http://svn.codehaus.org/geoserver/trunk/src",  gs)
Esempio n. 33
0
def setup_geoserver(options):
    """Prepare a testing instance of GeoServer."""
    with pushd('src/geoserver-geonode-ext'):
        sh("mvn clean install")