Skip to content

Commit

Permalink
improve couchapp installation:
Browse files Browse the repository at this point in the history
- include restkit in source
- move packages data in the packages
- remove setuptools dependancy, only rely on distutils
- plugins aren't depending on setuptools anymore
- move vendor in its own repository + templates.
  • Loading branch information
benoitc committed Jan 28, 2011
1 parent a056340 commit 06a4958
Show file tree
Hide file tree
Showing 112 changed files with 52 additions and 146 deletions.
8 changes: 0 additions & 8 deletions bin/couchapp.py

This file was deleted.

Binary file added couchapp/__init__.pyo
Binary file not shown.
Binary file added couchapp/client.pyo
Binary file not shown.
Binary file added couchapp/clone_app.pyo
Binary file not shown.
Binary file added couchapp/commands.pyo
Binary file not shown.
13 changes: 6 additions & 7 deletions couchapp/config.py
Expand Up @@ -5,9 +5,9 @@

import os

from couchapp.client import Database
from couchapp.errors import AppError
from couchapp import util
from .client import Database
from .errors import AppError
from . import util

class Config(object):
""" main object to read configuration from ~/.couchapp.conf or
Expand All @@ -20,13 +20,12 @@ class Config(object):
extensions = [],
hooks = {},
vendors = [
"egg:couchapp#git",
"egg:couchapp#hg",
"egg:couchapp#couchdb"
"python:couchapp.vendors.backends.git#GitVendor",
"python:couchapp.vendors.backends.hg#HgVendor",
"python:couchapp.vendors.backends.couchdb#CouchdbVendor"
]
)


def __init__(self):
self.rc_path = util.rcpath()
self.global_conf = self.load(self.rc_path, self.DEFAULTS)
Expand Down
Binary file added couchapp/config.pyo
Binary file not shown.
Binary file added couchapp/dispatch.pyo
Binary file not shown.
Binary file added couchapp/errors.pyo
Binary file not shown.
5 changes: 4 additions & 1 deletion couchapp/generator.py
Expand Up @@ -152,6 +152,9 @@ def generate_function(path, kind, name, template=None):

def copy_helper(path, directory, tname="templates"):
""" copy helper used to generate an app"""
if tname == "vendor":
tname = os.path.join("templates", tname)

templatedir = find_template_dir(tname, directory)
if templatedir:
if directory == "vendor":
Expand All @@ -160,7 +163,7 @@ def copy_helper(path, directory, tname="templates"):
os.makedirs(path)
except:
pass

for root, dirs, files in os.walk(templatedir):
rel = relpath(root, templatedir)
if rel == ".":
Expand Down
Binary file added couchapp/generator.pyo
Binary file not shown.
Binary file added couchapp/localdoc.pyo
Binary file not shown.
Binary file added couchapp/macros.pyo
Binary file not shown.
Binary file added couchapp/restkit/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/client/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/client/request.pyo
Binary file not shown.
Binary file added couchapp/restkit/client/response.pyo
Binary file not shown.
Binary file added couchapp/restkit/conn/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/conn/base.pyo
Binary file not shown.
Binary file added couchapp/restkit/conn/http_connection.pyo
Binary file not shown.
Binary file added couchapp/restkit/conn/threaded.pyo
Binary file not shown.
Binary file added couchapp/restkit/errors.pyo
Binary file not shown.
Binary file added couchapp/restkit/filters/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/filters/basicauth.pyo
Binary file not shown.
Binary file added couchapp/restkit/filters/oauth2.pyo
Binary file not shown.
Binary file added couchapp/restkit/filters/simpleproxy.pyo
Binary file not shown.
Binary file added couchapp/restkit/forms.pyo
Binary file not shown.
Binary file added couchapp/restkit/http/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/http/body.pyo
Binary file not shown.
Binary file added couchapp/restkit/http/message.pyo
Binary file not shown.
Binary file added couchapp/restkit/http/parser.pyo
Binary file not shown.
Binary file added couchapp/restkit/http/unreader.pyo
Binary file not shown.
Binary file added couchapp/restkit/resource.pyo
Binary file not shown.
Binary file added couchapp/restkit/util/__init__.pyo
Binary file not shown.
Binary file added couchapp/restkit/util/oauth2.pyo
Binary file not shown.
Binary file added couchapp/restkit/util/sock.pyo
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
{
"name": "couchapp",
"description": "official couchapp vendor",
"fetch_uri": "git://github.com/couchapp/couchapp.git"
}
"fetch_uri": "git://github.com/couchapp/vendor.git"
}
26 changes: 7 additions & 19 deletions couchapp/util.py
Expand Up @@ -9,12 +9,11 @@
from hashlib import md5
import logging
import os
import pkg_resources
import re
import string
import sys

from couchapp.errors import ScriptError, AppError
from .errors import ScriptError, AppError

try:
import json
Expand Down Expand Up @@ -385,31 +384,20 @@ def __call__(self, *args, **options):


def parse_uri(uri, section):
if uri.startswith("egg:"):
# uses entry points
entry_str = uri.split("egg:")[1]
try:
dist, name = entry_str.rsplit("#",1)
except ValueError:
dist = entry_str
name = "main"

return pkg_resources.load_entry_point(dist, section, name)
elif uri.startswith("python:"):
if uri.startswith("python:"):
uri1 = uri.split("python:")[1]
components = uri1.split('.')
if len(components) == 1:
raise RuntimeError("extension uri invalid")
klass = components.pop(-1)
mod = __import__('.'.join(components))
module_str, klass = uri1.split("#")
components = module_str.split('.')

mod = __import__(module_str)
for comp in components[1:]:
mod = getattr(mod, comp)
return getattr(mod, klass)
else:
raise RuntimeError("extension uri invalid")

def parse_hooks_uri(uri):
if uri.startswith("python:") or uri.startswith("egg:"):
if uri.startswith("python:"):
return parse_uri(uri, "couchapp.hook")
return ShellScript(uri)

Expand Down
Binary file added couchapp/util.pyo
Binary file not shown.
Binary file added couchapp/vendors/__init__.pyo
Binary file not shown.
Binary file added couchapp/vendors/base.pyo
Binary file not shown.
8 changes: 5 additions & 3 deletions resources/scripts/couchapp
@@ -1,7 +1,9 @@
#!/usr/bin/env sh
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of couchapp released under the Apache 2 license.
# See the NOTICE for more information.

PYTHON_BIN=`which python`
from couchapp.dispatch import run

$PYTHON_BIN -OO -c "import couchapp.dispatch"
run()
2 changes: 1 addition & 1 deletion resources/scripts/couchapp.bat
Expand Up @@ -2,4 +2,4 @@
REM This file is part of couchapp released under the Apache 2 license.
REM See the NOTICE for more information.

pythonw.exe -OO -c "import couchapp:dispatch"
pythonw.exe -OO -c "import couchapp:dispatch" %*
6 changes: 0 additions & 6 deletions resources/scripts/couchapp.py

This file was deleted.

126 changes: 27 additions & 99 deletions setup.py
Expand Up @@ -3,70 +3,42 @@
# This file is part of couchapp released under the Apache 2 license.
# See the NOTICE for more information.

from distutils.command.install_data import install_data
from distutils.core import setup

import os
import sys

from couchapp import __version__

if not hasattr(sys, 'version_info') or sys.version_info < (2, 5, 0, 'final'):
raise SystemExit("Couchapp requires Python 2.5 or later.")


executables = []
setup_requires = []
extra = {}
class install_package_data(install_data):
def finalize_options(self):
self.set_undefined_options('install',
('install_lib', 'install_dir'))
install_data.finalize_options(self)

cmdclass = {'install_data': install_package_data }


def get_data_files():
data_files = []

data_files.append((os.curdir,
["LICENSE", "MANIFEST.in", "NOTICE", "README.md",
"THANKS.txt",]))
return data_files

for root in ('templates', 'vendor'):
for dir, dirs, files in os.walk(root):
dirs[:] = [x for x in dirs if not x.startswith('.')]
files = [x for x in files if not x.startswith('.')]
data_files.append((os.path.join('couchapp', dir),
[os.path.join(dir, file_) for file_ in files]))

def get_include_files():
include_files = []

data_path_src = os.curdir
data_path_dst = os.curdir

filelist = ["LICENSE", "MANIFEST.in", "NOTICE", "README.md",
"THANKS.txt",]

for fl in filelist:
include_files.append((os.path.join(data_path_src, fl),
os.path.join(data_path_dst, fl)))

for root in ('templates', 'vendor'):
for dir, dirs, files in os.walk(root):
dirs[:] = [x for x in dirs if not x.startswith('.')]
files = [x for x in files if not x.startswith('.')]

for f in files:
src = os.path.join(dir, f)
include_files.append((src, src))
def ordinarypath(p):
return p and p[0] != '.' and p[-1] != '~'

def get_packages_data():
return {
"couchapp": [
"templates/*",
"vendor/*"
]
}
packagedata = {'couchapp': []}

for root in ('templates',):
for curdir, dirs, files in os.walk(os.path.join("couchapp", root)):
print curdir
curdir = curdir.split(os.sep, 1)[1]
dirs[:] = filter(ordinarypath, dirs)
for f in filter(ordinarypath, files):
f = os.path.join(curdir, f)
packagedata['couchapp'].append(f)
return packagedata

def all_packages():
return [
Expand All @@ -89,6 +61,7 @@ def get_scripts():
return [os.path.join("resources", "scripts", "couchapp")]
return [os.path.join("resources", "scripts", "couchapp.bat")]

Executable = None
if os.name == "nt" or sys.platform == "win32":
# py2exe needs to be installed to work
try:
Expand All @@ -113,19 +86,19 @@ def get_scripts():
if len(sys.argv) == 1:
sys.argv.append("py2exe")
sys.argv.append("-q")
Executable = lambda x, *y, **z: x
setup_requires = ["py2exe"]

extra['console'] = [{
'script': os.path.join("resources", "scripts", "couchapp"),
'copyright':'Copyright (C) 2008-2011 Benoît Chesneau and others',
'product_version': __version__
}]


except ImportError:
raise SystemExit('You need py2exe installed to run Couchapp.')
elif sys.platform == "linux2":
import cx_Freeze
from cx_Freeze import setup, Executable
setup_requires = ["cx_Freeze"]



from couchapp import __version__

setup(
name = 'Couchapp',
Expand Down Expand Up @@ -153,68 +126,23 @@ def get_scripts():
],

packages = all_packages(),
packages_data = get_packages_data(),
package_data = get_packages_data(),
data_files=get_data_files(),
include_package_data = True,

cmdclass=cmdclass,

scripts=get_scripts(),

executables=[
Executable(
"Couchapp.py",
compress=1,
copyDependentFiles=True)
],

options = dict(py2exe={
'compressed': 1,
'optimize': 2,
"ascii": 1,
"excludes": [
"pywin",
"pywin.debugger",
"pywin.debugger.dbgcon",
"pywin.dialogs",
"pywin.dialogs.list",
],
'dll_excludes': [
"kernelbase.dll",
"powrprof.dll"
]
},

build_exe={
"compressed": 1,
"optimize": 2,
"include_files": get_include_files(),
"create_shared_zip": 1,
"include_in_shared_zip": get_include_files()
},

bdist_mpkg=dict(zipdist=True,
license='LICENSE',
readme='resources/macosx/Readme.html',
welcome='resources/macosx/Welcome.html')
),

entry_points="""
[couchapp.extension]
autopush=couchapp.ext.autopush
[couchapp.vendor]
git=couchapp.vendors.backends.git:GitVendor
hg=couchapp.vendors.backends.hg:HgVendor
couchdb=couchapp.vendors.backends.couchdb:CouchdbVendor
[couchapp.hook]
compress=couchapp.hooks.compress:hook
[console_scripts]
couchapp=couchapp.dispatch:run
""",

setup_requires=setup_requires,

**extra
)

0 comments on commit 06a4958

Please sign in to comment.