[Pkg-owncloud-commits] [SCM] python-owncloud.git branch, master, updated. upstream/0.2+1.e1d0c876-9-g6795130
Sandro Knauß
bugs at sandroknauss.de
Mon Apr 8 00:24:07 UTC 2013
The following commit has been merged in the master branch:
commit f0d09717410db6e090f2f3e075e2ebbb1498df6c
Author: Sandro Knauß <bugs at sandroknauss.de>
Date: Mon Apr 8 01:01:21 2013 +0200
Imported Upstream version 0.2+2.db2246ab
diff --git a/.hg_archival.txt b/.hg_archival.txt
index 996d025..800c14b 100644
--- a/.hg_archival.txt
+++ b/.hg_archival.txt
@@ -1,5 +1,5 @@
repo: de2c55abe6f5f7e8c53d85b08add9b32feb01eea
-node: 8efd4fc89863c0defe9fc9eef43db813a18eaf7b
+node: e36423f7299b2e88472e22fb2b8161a7665cc551
branch: default
latesttag: null
-latesttagdistance: 61
+latesttagdistance: 70
diff --git a/CHANGELOG b/CHANGELOG
index da5f113..a4c121f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,17 @@
CHANGELOG
=========
+version 0.3 (unreleased - this updated to 20655515dedf8495f2701ec045b6b5c5e0dad25c [2065551])
+ * binary command is now called oclient.
+ * will prompt for password if not specified in other ways.
+ * has a setup.py and can be properly 'packaged' now.
+ * better finding of the csync C library
+ * uses python-keyring to use the same passwords as the owncloud-client if
+ available
+ * LICENSE and copyright changes, now all GPL-2
+ * fixed how we handle versioning to be better.
+
+
version 0.2 (releaded 2013-03-12)
-----------
* Lots of UI cleanup
diff --git a/LICENSE b/LICENSE
index 4656a60..ce6da74 100644
--- a/LICENSE
+++ b/LICENSE
@@ -3,8 +3,7 @@ Copyright (C) 2013 pyOwnCloud contributers
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/README.md b/README.md
index 6ee45e5..14bc1b5 100644
--- a/README.md
+++ b/README.md
@@ -28,9 +28,9 @@ Installation:
python setup.py install
-usage: just run csync -h, and it will give you help.
+usage: just run oclient -h, and it will give you help.
- usage: csync.py [-h] [-v] [-c [CONFIG]] [-u [USER]] [--ssl [SSLFINGERPRINT]]
+ usage: oclient.py [-h] [-v] [-c [CONFIG]] [-u [USER]] [--ssl [SSLFINGERPRINT]]
[-p [PASS]] [--dry-run] [--debug] [-s [SRC]] [-d [DST]]
[--url [URL]] [--use-keyring]
diff --git a/copyright b/copyright
index 70768e0..e171a77 100644
--- a/copyright
+++ b/copyright
@@ -1,4 +1,4 @@
-pyOwnCloud is copyrighted by Craig Sawyer and others.
+Copyright (C) 2013 pyOwnCloud contributers
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/csync/csync.py b/csync/csync.py
index 6b030f4..747207e 100755
--- a/csync/csync.py
+++ b/csync/csync.py
@@ -223,9 +223,12 @@ def getConfig(args):
pprint.pprint(pargs)
newArgs = {}
for k, v in args.iteritems():
+ if k == "use_keyring":
+ k = "use-keyring"
if v:
newArgs[k] = v
args = newArgs
+ print args
cfg = {}
cfgFile = None
if args.has_key('config'):
@@ -253,7 +256,7 @@ def getConfig(args):
cfg.setdefault('sslfingerprint' '')
cfg.setdefault('pass', None)
cfg.setdefault('user', getpass.getuser())
- cfg.setdefault('not-use-keyring', False)
+ cfg.setdefault('use-keyring', False)
if os.environ.has_key('OCPASS'):
cfg['pass'] = os.environ['OCPASS']
if DEBUG:
diff --git a/csync/version.dat b/csync/version.dat
index 4ed816b..c088d7f 100644
--- a/csync/version.dat
+++ b/csync/version.dat
@@ -1 +1 @@
-{"head": "5c32717e4b3770da29c4ba61004be2e0239c2616", "float": 0.2, "string": "0.2"}
\ No newline at end of file
+{"head": "20655515dedf8495f2701ec045b6b5c5e0dad25c", "float": 0.2, "string": "0.2"}
\ No newline at end of file
diff --git a/csync/version.py b/csync/version.py
index d21a980..d49bba1 100644
--- a/csync/version.py
+++ b/csync/version.py
@@ -1,6 +1,10 @@
import subprocess
import json
import os
+import pkg_resources
+
+verfile = pkg_resources.resource_filename(__name__, 'version.dat')
+
class ver(object):
def __init__(self, verfile='version.dat'):
self.verfile = verfile
@@ -88,8 +92,10 @@ class gitVersion(ver):
"""if git is around, return the current version and save it.
otherwise return the saved copy, or 00 if not already saved.
"""
- gitdir = os.path.join(os.path.dirname(os.path.abspath(self.verfile)),'.git')
+ gitdir = os.path.join(os.path.dirname(os.path.abspath(self.verfile)),'..','.git')
if not os.path.exists(gitdir):
+ if self.version.has_key('head'):
+ return self.version['head']
return '00'
cmd = 'git rev-parse --verify HEAD'.split()
try:
@@ -113,12 +119,13 @@ class gitVersion(ver):
def asHead(self):
return self.getHeadVersion()
-BASE_DIR = os.path.abspath(os.path.dirname(__file__))
-if os.path.exists(os.path.join(BASE_DIR, 'devel')):
- version = gitVersion(os.path.join(BASE_DIR, 'version.dat'))
-else:
- version = ver(os.path.join(BASE_DIR, 'version.dat'))
+#BASE_DIR = os.path.abspath(os.path.dirname(__file__))
+#if os.path.exists(os.path.join(BASE_DIR, 'devel')):
+# version = gitVersion(os.path.join(BASE_DIR, 'version.dat'))
+#else:
+# version = ver(os.path.join(BASE_DIR, 'version.dat'))
+version = gitVersion(verfile)
if __name__ == '__main__':
print 'Testing version.'
diff --git a/distribute_setup.py b/distribute_setup.py
index 5a95c92..a447f7e 100644
--- a/distribute_setup.py
+++ b/distribute_setup.py
@@ -14,11 +14,14 @@ the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import os
+import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
+import optparse
+
from distutils import log
try:
@@ -46,7 +49,7 @@ except ImportError:
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
-DEFAULT_VERSION = "0.6.21"
+DEFAULT_VERSION = "0.6.35"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
@@ -63,7 +66,7 @@ Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
-def _install(tarball):
+def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
@@ -81,11 +84,14 @@ def _install(tarball):
# installing
log.warn('Installing Distribute')
- if not _python_cmd('setup.py', 'install'):
+ if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
+ # exitcode will be 2
+ return 2
finally:
os.chdir(old_wd)
+ shutil.rmtree(tmpdir)
def _build_egg(egg, tarball, to_dir):
@@ -110,6 +116,7 @@ def _build_egg(egg, tarball, to_dir):
finally:
os.chdir(old_wd)
+ shutil.rmtree(tmpdir)
# returning the result
log.warn(egg)
if not os.path.exists(egg):
@@ -144,7 +151,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
- pkg_resources.require("distribute>="+version)
+ pkg_resources.require("distribute>=" + version)
return
except pkg_resources.VersionConflict:
e = sys.exc_info()[1]
@@ -167,6 +174,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
if not no_fake:
_create_fake_setuptools_pkg_info(to_dir)
+
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
"""Download distribute from a specified location and return its filename
@@ -203,6 +211,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
dst.close()
return os.path.realpath(saveto)
+
def _no_sandbox(function):
def __no_sandbox(*args, **kw):
try:
@@ -227,9 +236,12 @@ def _no_sandbox(function):
return __no_sandbox
+
def _patch_file(path, content):
"""Will backup the file then patch it"""
- existing_content = open(path).read()
+ f = open(path)
+ existing_content = f.read()
+ f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
@@ -245,15 +257,21 @@ def _patch_file(path, content):
_patch_file = _no_sandbox(_patch_file)
+
def _same_content(path, content):
- return open(path).read() == content
+ f = open(path)
+ existing_content = f.read()
+ f.close()
+ return existing_content == content
+
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
- log.warn('Renaming %s into %s', path, new_name)
+ log.warn('Renaming %s to %s', path, new_name)
os.rename(path, new_name)
return new_name
+
def _remove_flat_installation(placeholder):
if not os.path.isdir(placeholder):
log.warn('Unkown installation at %s', placeholder)
@@ -267,7 +285,7 @@ def _remove_flat_installation(placeholder):
log.warn('Could not locate setuptools*.egg-info')
return
- log.warn('Removing elements out of the way...')
+ log.warn('Moving elements out of the way...')
pkg_info = os.path.join(placeholder, file)
if os.path.isdir(pkg_info):
patched = _patch_egg_dir(pkg_info)
@@ -289,11 +307,13 @@ def _remove_flat_installation(placeholder):
_remove_flat_installation = _no_sandbox(_remove_flat_installation)
+
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
+
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
@@ -307,7 +327,11 @@ def _create_fake_setuptools_pkg_info(placeholder):
return
log.warn('Creating %s', pkg_info)
- f = open(pkg_info, 'w')
+ try:
+ f = open(pkg_info, 'w')
+ except EnvironmentError:
+ log.warn("Don't have permissions to write %s, skipping", pkg_info)
+ return
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
@@ -321,7 +345,10 @@ def _create_fake_setuptools_pkg_info(placeholder):
finally:
f.close()
-_create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info)
+_create_fake_setuptools_pkg_info = _no_sandbox(
+ _create_fake_setuptools_pkg_info
+)
+
def _patch_egg_dir(path):
# let's check if it's already patched
@@ -343,6 +370,7 @@ def _patch_egg_dir(path):
_patch_egg_dir = _no_sandbox(_patch_egg_dir)
+
def _before_install():
log.warn('Before install bootstrap.')
_fake_setuptools()
@@ -351,7 +379,7 @@ def _before_install():
def _under_prefix(location):
if 'install' not in sys.argv:
return True
- args = sys.argv[sys.argv.index('install')+1:]
+ args = sys.argv[sys.argv.index('install') + 1:]
for index, arg in enumerate(args):
for option in ('--root', '--prefix'):
if arg.startswith('%s=' % option):
@@ -359,7 +387,7 @@ def _under_prefix(location):
return location.startswith(top_dir)
elif arg == option:
if len(args) > index:
- top_dir = args[index+1]
+ top_dir = args[index + 1]
return location.startswith(top_dir)
if arg == '--user' and USER_SITE is not None:
return location.startswith(USER_SITE)
@@ -376,11 +404,14 @@ def _fake_setuptools():
return
ws = pkg_resources.working_set
try:
- setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools',
- replacement=False))
+ setuptools_dist = ws.find(
+ pkg_resources.Requirement.parse('setuptools', replacement=False)
+ )
except TypeError:
# old distribute API
- setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools'))
+ setuptools_dist = ws.find(
+ pkg_resources.Requirement.parse('setuptools')
+ )
if setuptools_dist is None:
log.warn('No setuptools distribution found')
@@ -414,7 +445,7 @@ def _fake_setuptools():
res = _patch_egg_dir(setuptools_location)
if not res:
return
- log.warn('Patched done.')
+ log.warn('Patching complete.')
_relaunch()
@@ -422,7 +453,9 @@ def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
# pip marker to avoid a relaunch bug
- if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']:
+ _cmd1 = ['-c', 'install', '--single-version-externally-managed']
+ _cmd2 = ['-c', 'install', '--record']
+ if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
@@ -448,7 +481,7 @@ def _extractall(self, path=".", members=None):
# Extract directories with a safe mode.
directories.append(tarinfo)
tarinfo = copy.copy(tarinfo)
- tarinfo.mode = 448 # decimal for oct 0700
+ tarinfo.mode = 448 # decimal for oct 0700
self.extract(tarinfo, path)
# Reverse sort directories.
@@ -475,11 +508,39 @@ def _extractall(self, path=".", members=None):
self._dbg(1, "tarfile: %s" % e)
-def main(argv, version=DEFAULT_VERSION):
+def _build_install_args(options):
+ """
+ Build the arguments to 'python setup.py install' on the distribute package
+ """
+ install_args = []
+ if options.user_install:
+ if sys.version_info < (2, 6):
+ log.warn("--user requires Python 2.6 or later")
+ raise SystemExit(1)
+ install_args.append('--user')
+ return install_args
+
+def _parse_args():
+ """
+ Parse the command line for options
+ """
+ parser = optparse.OptionParser()
+ parser.add_option(
+ '--user', dest='user_install', action='store_true', default=False,
+ help='install in user site package (requires Python 2.6 or later)')
+ parser.add_option(
+ '--download-base', dest='download_base', metavar="URL",
+ default=DEFAULT_URL,
+ help='alternative URL from where to download the distribute package')
+ options, args = parser.parse_args()
+ # positional arguments are ignored
+ return options
+
+def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
- tarball = download_setuptools()
- _install(tarball)
-
+ options = _parse_args()
+ tarball = download_setuptools(download_base=options.download_base)
+ return _install(tarball, _build_install_args(options))
if __name__ == '__main__':
- main(sys.argv[1:])
+ sys.exit(main())
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index 4ae2a83..d45acc3 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -3,6 +3,6 @@
#
[specialwords]
ifndef::doctype-manpage[]
-emphasizedwords=(?u)\\?\bCSYNC\b
-monospacedwords=(?u)\\?\bcsync\(1\)
+emphasizedwords=(?u)\\?\bOCLIENT\b
+monospacedwords=(?u)\\?\boclient\(1\)
endif::doctype-manpage[]
diff --git a/doc/csync.1 b/doc/oclient.1
similarity index 88%
rename from doc/csync.1
rename to doc/oclient.1
index 29d5288..465af35 100644
--- a/doc/csync.1
+++ b/doc/oclient.1
@@ -1,5 +1,5 @@
'\" t
-.\" Title: csync
+.\" Title: oclient
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 04/03/2013
@@ -7,7 +7,7 @@
.\" Source: \ \&
.\" Language: English
.\"
-.TH "CSYNC" "1" "04/03/2013" "\ \&" "\ \&"
+.TH "OCLIENT" "1" "04/03/2013" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -28,10 +28,10 @@
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
-csync \- ownCloud CLI client written in python
+oclient \- ownCloud CLI client written in python
.SH "SYNOPSIS"
.sp
-\fBcsync\fR [\-h] [\-v] [\-c \fICONFIG\fR] [\-u \fIUSER\fR] [\-\-ssl \fISSLFINGERPRINT\fR] [\-p \fIPASS\fR] [\-\-dry\-run] [\-\-debug] [\-s \fISRC\fR] [\-d \fIDST\fR] [\-\-url \fIURL\fR] [\-\-use\-keyring]
+\fBoclient\fR [\-h] [\-v] [\-c \fICONFIG\fR] [\-u \fIUSER\fR] [\-\-ssl \fISSLFINGERPRINT\fR] [\-p \fIPASS\fR] [\-\-dry\-run] [\-\-debug] [\-s \fISRC\fR] [\-d \fIDST\fR] [\-\-url \fIURL\fR] [\-\-use\-keyring]
.SH "DESCRIPTION"
.sp
Syncing files across machines using ownCloud DAV server\&.
@@ -163,7 +163,9 @@ show program\(cqs version number and exit
.RE
.SH "CONFIGURATION FILE"
.sp
-The csync configuration file can be found in \fI$HOME/\&.local/share/data/ownCloud/owncloud\&.cfg\fR\&. Only the \fBownCloud\fR section is supported\&. This file is also ued by the normal owncloud\-client\&.
+The oclient configuration file can be found in \fI$HOME/\&.local/share/data/ownCloud/owncloud\&.cfg\fR\&.
+.sp
+Only the \fBownCloud\fR section is supported\&. This file is also used by the normal owncloud\-client\&.
.sp
Supported keys in the cfg file:
.PP
diff --git a/doc/csync.1.txt b/doc/oclient.1.txt
similarity index 91%
rename from doc/csync.1.txt
rename to doc/oclient.1.txt
index 76422df..e4d8562 100644
--- a/doc/csync.1.txt
+++ b/doc/oclient.1.txt
@@ -1,16 +1,16 @@
-csync(1)
+oclient(1)
========
NAME
----
-csync - ownCloud CLI client written in python
+oclient - ownCloud CLI client written in python
SYNOPSIS
--------
-*csync* [-h] [-v] [-c 'CONFIG'] [-u 'USER'] [--ssl 'SSLFINGERPRINT']
+*oclient* [-h] [-v] [-c 'CONFIG'] [-u 'USER'] [--ssl 'SSLFINGERPRINT']
[-p 'PASS'] [--dry-run] [--debug] [-s 'SRC'] [-d 'DST']
[--url 'URL'] [--use-keyring]
@@ -66,7 +66,8 @@ OPTIONS
CONFIGURATION FILE
------------------
-The csync configuration file can be found in '$HOME/.local/share/data/ownCloud/owncloud.cfg'.
+The oclient configuration file can be found in '$HOME/.local/share/data/ownCloud/owncloud.cfg'.
+
Only the *ownCloud* section is supported. This file is also used by the normal owncloud-client.
Supported keys in the cfg file:
diff --git a/pre-commit b/pre-commit
new file mode 100755
index 0000000..a6df5c2
--- /dev/null
+++ b/pre-commit
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+#set the version
+python -c 'from csync import version; version.version.asHead'
diff --git a/setup.py b/setup.py
index e16f7da..658fb0a 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ setup(
},
entry_points = {
'console_scripts': [
- 'csync = csync.csync:main',
+ 'oclient = csync.csync:main',
],
},
extras_require = {
--
python-owncloud.git
More information about the Pkg-owncloud-commits
mailing list