pax_global_header00006660000000000000000000000064122440002540014503gustar00rootroot0000000000000052 comment=cb55135182f1e020aa10240cf1b6aa35ee84b7bc pyowncloud-0.3.1/000077500000000000000000000000001224400025400137075ustar00rootroot00000000000000pyowncloud-0.3.1/.gitignore000066400000000000000000000004571224400025400157050ustar00rootroot00000000000000*.py[cod] # C extensions *.so # Packages *.egg *.egg-info dist build eggs parts bin var sdist develop-eggs .installed.cfg lib lib64 # Installer logs pip-log.txt # Unit test / coverage reports .coverage .tox nosetests.xml # Translations *.mo # Mr Developer .mr.developer.cfg .project .pydevproject pyowncloud-0.3.1/CHANGELOG000066400000000000000000000024341224400025400151240ustar00rootroot00000000000000CHANGELOG ========= version 0.3.1 * Added bandwidth throttling. * Raise an error if no url is defined at all. * Print csync version to error output. * Updated the csync_ftw_type_e to the values of 0.90.4. * Updated the csync_notify_type_e to the values of 0.90.4. * Updated the csync_error_codes_e to the values of 0.90.4. * Fixed: Authentication callback prints real password in debug mode. * Fixed: Indent in csync/csynclib.py. version 0.3 (released 2013-04-15) * binary command is now called oclient. * Manpage created. * keyring bugfixes. * tested against version 0.70.5 of csync library. * 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 (released 2013-03-12) ----------- * Lots of UI cleanup * loads more error checking * Works beyond the orignal author's machine. * Thanks to Weuxel (https://github.com/Weuxel) for lots of documenation and cleanup. * Thanks to duck (https://github.com/duck) for lots of testing! version 0.1 (released 2013-03-09) ----------- * Initial release pyowncloud-0.3.1/LICENSE000066400000000000000000000442741224400025400147270ustar00rootroot00000000000000pyOwnCloud - ownCloud CLI client written in python 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; 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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. pyowncloud-0.3.1/README.md000066400000000000000000000106271224400025400151740ustar00rootroot00000000000000pyOwnCloud ========== ownCloud CLI client written in python, more info about owncloud: www.owncloud.org This code is now in production use, and has been tested against a variety of Linux machines, other platforms should work, but are currently untested. This code is in no way currently endorsed or supported by ownCloud, all bugs should be reported here and not there. Support/Discussion: ------------------- * Use github for issues/patches/etc: https://github.com/csawyerYumaed/pyOwnCloud * For discussion use: http://lists.cknow.org/listinfo.cgi/pyowncloud-cknow.org (pyowncloud <@> lists.cknow.org) Requirements: ------------- * The ocsync C library from ownCloud. If you install Mirall/owncloud-client, you get it for free on Linux. If you don't want to install mirall, you have to install the 'ocsync' binary package, usually named 'libocsync0' and the owncloud plugin, usually named 'libocsync-plugin-owncloud'. Installing the plugin should also install 'libocsync0' as a dependency. When running Debian (jessy) or Ubuntu raring, you can install it right from the archives. For other distributions you can get them through https://build.opensuse.org/package/show/isv:ownCloud:devel/ocsync . * Python > 2.6 < 3 (patches welcome) * An ownCloud server to sync with. (Presumably you already have one of these.) * argparse for python (included with python > 2.6) Installation: ------------- * standard python setup.py script. * It will create a new command called oclient, and you can call that :) python setup.py install usage: just run oclient -h, and it will give you help. usage: oclient [-h] [-v] [-c [CONFIG]] [-u [USER]] [--ssl [SSLFINGERPRINT]] [-p [PASS]] [--dry-run] [--debug] [-s [SRC]] [-d [DST]] [--url [URL]] [--use-keyring] [--downloadlimit [DOWNLOADLIMIT]] [--uploadlimit [UPLOADLIMIT]] Synchronize files across machines using ownCloud DAV server. optional arguments: -h, --help Show this help message and exit -v, --version Show program's version number and exit -c [CONFIG], --config [CONFIG] Configuration to use. -u [USER], --user [USER] Username on server. --ssl [SSLFINGERPRINT] SSL fingerprint on server to accept. -p [PASS], --pass [PASS] Password on server. You can also store this in environment variable OCPASS. --dry-run Dry Run, do not actually execute command. --debug Print a bunch of debug info. -s [SRC], --src [SRC] Local Directory to sync with. -d [DST], --dst [DST] Folder on server. --url [URL] URL to sync to. --use-keyring use keyring if available to store password safely. --downloadlimit [DOWNLOADLIMIT] Download limit in KB/s. --uploadlimit [UPLOADLIMIT] Upload limit in KB/s. oclient supports the ownCloud config file, which is located here: $HOME/.local/share/data/ownCloud/owncloud.cfg oclient only supports the 'ownCloud' section of the config. oclient support for download/upload limits requires libocsync version >= 0.81.0 these versions also support 'BWLimit' section of the config. oclient supports the following keys in the cfg file: user: username on the ownCloud server pass: password on the ownCloud server url: url of the ownCloud server sslfingerprint: valid SSL fingerprint for the server src: local directory to sync against dst: folder on the server to sync against complete example: [ownCloud] user=awesomeSauce pass=PasswordThisIsSuperSuperSecretReallyISwearLOL url=https://www.example.org/owncloud/ sslfingerprint= src=/home/awesomeSauce/ownCloud dst=clientsync Password options: *) You can specify on the cmd line: -p (not very safe) *) In the environment variable: OCPASS *) In the owncloud.cfg file as pass = *) Use keyring to store passwords in a keyring. (needs Python Keyring Lib to be installed) *) Do none of the above, and it will prompt you for the password. The choice is yours, if you put it in the cfg file, be careful to make sure nobody but you can read the file. (0400/0600 file perms). pyowncloud-0.3.1/copyright000066400000000000000000000015651224400025400156510ustar00rootroot00000000000000Copyright (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; version 2 dated June, 1991. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2' or via the web at: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html pyowncloud-0.3.1/csync/000077500000000000000000000000001224400025400150265ustar00rootroot00000000000000pyowncloud-0.3.1/csync/__init__.py000066400000000000000000000000001224400025400171250ustar00rootroot00000000000000pyowncloud-0.3.1/csync/csync.py000077500000000000000000000302461224400025400165270ustar00rootroot00000000000000#!/usr/bin/env python import os import sys import argparse import ConfigParser import ctypes import re import pprint import copy import getpass try: import keyring except: keyring = None import csynclib import version VERSION = version.version #Use global variables for user/pass & fingerprint because we have to handle this C callback stuff. USERNAME = '' PASSWORD = '' PASSWORD_SAFE = '********' SSLFINGERPRINT = '' DEBUG = False USE_KEYRING = False def CSYNC_VERSION_INT(a, b, c): return ((a) << 16 | (b) << 8 | (c)) def authCallback(prompt, buffer, bufferLength, echo, verify, userData): """ (const char *prompt, char *buf, size_t len, int echo, int verify, void *userdata) called like this: ("Enter your username: ", buf, NE_ABUFSIZ-1, 1, 0, dav_session.userdata ) type is 1 for username, 0 for password. """ if DEBUG: print 'authCallback:', prompt, buffer, bufferLength, echo, verify, userData #print 'string:', ctypes.string_at(buffer, bufferLength-1) ret = None if 'username' in prompt: ret = USERNAME elif 'password' in prompt: if keyring and USE_KEYRING: print "using password from keyring" ret = keyring.get_password('ownCloud', USERNAME) if ret is None: if not PASSWORD: ret = getpass.getpass('ownCloud password:') else: ret = PASSWORD if keyring and USE_KEYRING: print "saving password to keyring" keyring.set_password('ownCloud', USERNAME, ret) elif 'SSL' in prompt: fingerprint = re.search("fingerprint: ([\\w\\d:]+)", prompt).group(1) if fingerprint == SSLFINGERPRINT: ret = 'yes' else: print 'SSL fingerprint: %s not accepted, aborting' % fingerprint ret = 'no' else: print 'authCallback: unknown prompt:', prompt return -1 bufferLength = len(ret) for i in range(len(ret)): ctypes.memset(buffer+i, ord(ret[i]), 1) if DEBUG: buffString = ctypes.string_at(buffer, bufferLength) if 'password' in prompt: if ret and ret in buffString: buffString = buffString.replace(ret, PASSWORD_SAFE) print 'returning:', buffString return 0 class ownCloudSync(): """This handles the actual syncying with ownCloud cfg is a {}. should have these things: user: pass: url: src: None of them are optional. :) optional items: SSLfingerPrint: """ def __init__(self, cfg = None): """initialize""" self.cfg = cfg global USERNAME, PASSWORD, SSLFINGERPRINT, USE_KEYRING USERNAME = cfg['user'] PASSWORD = cfg['pass'] SSLFINGERPRINT = cfg['sslfingerprint'] USE_KEYRING = cfg['use_keyring'] libVersion = csynclib.csync_version(0,40,1) if DEBUG: print 'libocsync version: ', libVersion c = csynclib.CSYNC() self.ctx = ctypes.pointer(c) self.buildURL() #pprint.pprint(self.cfg) print 'Syncing %s to %s logging in as user: %s' % (self.cfg['src'], self.cfg['url'], USERNAME, ) if cfg.has_key('dry_run') and cfg['dry_run']: return self.sync() def buildURL(self): """build the URL we use for owncloud""" url = self.cfg['url'] if not url: print 'You must specify a url, use --url, or put in cfg file.' sys.exit(1) url = url.replace('https','ownclouds') url = url.replace('http','owncloud') #add / if needed if url[-1:] != '/': url = ''.join((url,'/')) url += self.cfg['davPath'] #add / if needed if url[-1:] != '/': url = ''.join((url,'/')) url = ''.join((url, self.cfg['dst'])) #take off any trailing slash. if url[-1:] == '/': url = url[:-1] self.cfg['url'] = url if DEBUG: print 'buildURL: ', url return def sync(self): r = csynclib.csync_create(self.ctx, self.cfg['src'], self.cfg['url']) if r != 0: error(self.ctx,'csync_create', r) csynclib.csync_set_log_callback(self.ctx, csynclib.csync_log_callback(log)) acb = csynclib.csync_auth_callback(authCallback) if DEBUG: print 'authCallback setup' csynclib.csync_set_auth_callback(self.ctx, acb) r = csynclib.csync_init(self.ctx) if r != 0: error(self.ctx, 'csync_init', r) if DEBUG: print 'Initialization done.' if (self.cfg.has_key('downloadlimit') and self.cfg['downloadlimit']) or \ (self.cfg.has_key('uploadlimit') and self.cfg['uploadlimit']): if csynclib.csync_version(CSYNC_VERSION_INT(0,81,0)) is None: print 'Bandwidth throttling requires ocsync version >= 0.81.0, ignoring limits' else: if self.cfg.has_key('downloadlimit') and self.cfg['downloadlimit']: dlimit = ctypes.c_int(int(self.cfg['downloadlimit']) * 1000) if DEBUG: print 'Download limit: ', dlimit.value csynclib.csync_set_module_property(self.ctx, 'bandwidth_limit_download', ctypes.pointer(dlimit)) if self.cfg.has_key('uploadlimit') and self.cfg['uploadlimit']: ulimit = ctypes.c_int(int(self.cfg['uploadlimit']) * 1000) if DEBUG: print 'Upload limit: ', ulimit.value csynclib.csync_set_module_property(self.ctx,'bandwidth_limit_upload',ctypes.pointer(ulimit)) #csynclib.csync_set_log_verbosity(self.ctx, ctypes.c_int(11)) r = csynclib.csync_update(self.ctx) if r != 0: error(self.ctx, 'csync_update', r) if DEBUG: print 'Update done.' r = csynclib.csync_reconcile(self.ctx) if r != 0: error(self.ctx, 'csync_reconcile', r) if DEBUG: print 'Reconcile done.' r = csynclib.csync_propagate(self.ctx) if r != 0: error(self.ctx, 'csync_propogate', r) if DEBUG: print 'Propogate finished, destroying.' r = csynclib.csync_destroy(self.ctx) if r != 0: error(self.ctx, 'csync_destroy', r) return def log(ctx, verbosity, function, buffer, userdata): """Log stuff from the ocsync library, but it does not work...""" print 'LOG:', verbosity, function, buffer, userdata return 0 def error(ctx, cmd, returnCode): """handle library errors""" libVersion = csynclib.csync_version(0,40,1) errNum = csynclib.csync_get_error(ctx) errMsg = csynclib.csync_get_error_string(ctx) if not errMsg: if errNum == csynclib.CSYNC_ERR_AUTH_SERVER and cmd == 'csync_update': errMsg = 'This is an authentication problem with the server, check user/pass.' if errNum == csynclib.CSYNC_ERR_NOT_FOUND and cmd == 'csync_update': errMsg = 'This is a remote folder destination issue, check that the remote folder exists on ownCloud.' print 'ERROR: %s exited with %s, csync(%s) error %s: %s' % ( cmd, returnCode, libVersion, errNum, errMsg, ) sys.exit(1) def getConfigPath(): """get the local configuration file path """ if sys.platform.startswith('linux'): cfgPath = os.path.join('~','.local','share','data','ownCloud') cfgPath = os.path.expanduser(cfgPath) elif sys.platform == 'darwin': cfgPath = os.path.join('~','Library','Application Support','ownCloud') cfgPath = os.path.expanduser(cfgPath) elif 'win' in sys.platform: cfgPath = os.path.join('%LOCALAPPDATA%','ownCloud') cfgPath = os.path.expandvars(cfgPath) else: print 'Unkown/not supported platform %s, please file a bug report. ' % sys.platform sys.exit(1) if DEBUG: print 'getConfigPath:', cfgPath return cfgPath def getConfig(parser): args = vars(parser.parse_args()) if DEBUG: print 'From args: ' pargs = copy.copy(args) if pargs['pass']: pargs['pass'] = PASSWORD_SAFE pprint.pprint(pargs) newArgs = {} for k, v in args.iteritems(): if v: newArgs[k] = v args = newArgs cfg = {} cfgFile = None if args.has_key('config'): cfgFile = args['config'] else: cfgPath = getConfigPath() if os.path.exists(os.path.join(cfgPath,'owncloud.cfg')): cfgFile = os.path.join(cfgPath, 'owncloud.cfg') if cfgFile: with open(cfgFile) as fd: """We use the INI file format that Mirall does. we allow more things in the cfg file... pass: the password """ c = ConfigParser.SafeConfigParser() c.readfp(fd) if csynclib.csync_version(CSYNC_VERSION_INT(0,81,0)) is None: cfg = dict(c.items('ownCloud')) else: if c.has_section('BWLimit'): cfg = dict(c.items('BWLimit') + c.items('ownCloud')) if not cfg['useuploadlimit']: cfg['uploadlimit'] = None if not cfg['usedownloadlimit']: cfg['downloadlimit'] = None else: if DEBUG: print 'config file has no section [BWLimit]' cfg = dict(c.items('ownCloud')) if DEBUG: print 'conifguration info received from %s:' % cfgFile pcfg = copy.copy(cfg) if pcfg.has_key('pass'): pcfg['pass'] = PASSWORD_SAFE pprint.pprint(pcfg) cfg.setdefault('davPath', 'remote.php/webdav/') cfg.setdefault('sslfingerprint' '') cfg.setdefault('pass', None) cfg.setdefault('user', getpass.getuser()) cfg.setdefault('use_keyring', False) if os.environ.has_key('OCPASS'): cfg['pass'] = os.environ['OCPASS'] if DEBUG: print 'password coming from environment' #cmd line arguments win out over config files. parser.set_defaults(**cfg) args = vars(parser.parse_args()) cfg.update(args) if DEBUG: print 'Finished config file:' pcfg = copy.copy(cfg) if pcfg.has_key('pass'): pcfg['pass'] = PASSWORD_SAFE pprint.pprint(pcfg) return cfg def startSync(parser): cfg = getConfig(parser) try: ownCloudSync(cfg) except KeyError: exc_type, exc_value, exc_tb = sys.exc_info() print 'Sorry this option: %s is required, was not found in cfg file or on cmd line.' % (exc_value) if DEBUG: raise def main(): parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description = 'Synchronize files across machines using ownCloud DAV server.', epilog = """ oclient supports the ownCloud config file, which is located here: {cfg} oclient only supports the 'ownCloud' section of the config. oclient supports the following keys in the cfg file: user: username on the ownCloud server pass: password on the ownCloud server url: url of the ownCloud server sslfingerprint: valid SSL fingerprint for the server src: local directory to sync against dst: folder on the server to sync against complete example: [ownCloud] user=awesomeSauce pass=PasswordThisIsSuperSuperSecretReallyISwearLOL url=https://www.example.org/owncloud/ sslfingerprint= src=/home/awesomeSauce/ownCloud dst=clientsync Password options: *) You can specify on the cmd line: -p (not very safe) *) In the envifonment variable: OCPASS *) In the owncloud.cfg file as pass = *) Do none of the above, and it will prompt you for the password. *) Use keyring to store passwords in a keyring. (keyring package is {keyring}installed) The choice is yours, if you put it in the cfg file, be careful to make sure nobody but you can read the file. (0400/0600 file perms). """.format(cfg = os.path.join(getConfigPath(),'owncloud.cfg'), keyring="" if keyring else "NOT "), ) v = "%s - repo: %s" % (VERSION.asString, VERSION.asHead) parser.add_argument('-v', '--version', action='version', version = '%(prog)s ' + v) parser.add_argument('-c', '--config', nargs='?', default = None, help = "Configuration to use.") parser.add_argument('-u', '--user', nargs='?', default = None, help = "Username on server.") parser.add_argument('--ssl', nargs='?', default = None, dest = 'sslfingerprint', help = "SSL fingerprint on server to accept.") parser.add_argument('-p', '--pass', nargs='?', default = None, help = "Password on server. You can also store this in environment variable OCPASS.") parser.add_argument('--dry-run', action = 'store_true', default = False, help = "Dry Run, do not actually execute command.") parser.add_argument('--debug', action = 'store_true', default = False, help = "Print a bunch of debug info.") parser.add_argument('-s', '--src', nargs='?', default = os.path.expanduser(os.path.join('~','ownCloud')), help = "Local Directory to sync with.") parser.add_argument('-d', '--dst', nargs='?', default = 'clientsync', help = "Folder on server.") parser.add_argument('--url', nargs='?', default = None, help = "URL to sync to.") if csynclib.csync_version(CSYNC_VERSION_INT(0,81,0)) is not None: parser.add_argument('--downloadlimit', nargs = '?', default = None, help = "Download limit in KB/s.") parser.add_argument('--uploadlimit', nargs = '?', default = None, help = "Upload limit in KB/s.") if keyring: parser.add_argument('--use-keyring', action = 'store_true', default = False, help = "use keyring if available to store password safely.") args = vars(parser.parse_args()) if args['debug']: global DEBUG DEBUG = True print 'Turning debug on' startSync(parser) if __name__ == '__main__': main() # vim: noet:ts=4:sw=4:sts=4 pyowncloud-0.3.1/csync/csynclib.py000066400000000000000000000757401224400025400172230ustar00rootroot00000000000000from ctypes import * import ctypes.util import os import sys STRING = c_char_p _libraries = {} if os.path.exists('/usr/lib/libocsync.so.0'): _libraries['/usr/lib/libocsync.so.0'] = CDLL('/usr/lib/libocsync.so.0') elif os.path.exists('/usr/lib64/libocsync.so.0'): _libraries['/usr/lib/libocsync.so.0'] = CDLL('/usr/lib64/libocsync.so.0') else: path = ctypes.util.find_library('ocsync') if path: print 'Found libocsync @', path _libraries['/usr/lib/libocsync.so.0'] = CDLL(path) else: print 'ERROR, can not find shared library libocsync' sys.exit(1) class LP_LP_csync_s(Structure): pass class csync_s(Structure): pass CSYNC = csync_s csync_create = _libraries['/usr/lib/libocsync.so.0'].csync_create csync_create.restype = c_int csync_create.argtypes = [POINTER(POINTER(CSYNC)), STRING, STRING] csync_init = _libraries['/usr/lib/libocsync.so.0'].csync_init csync_init.restype = c_int csync_init.argtypes = [POINTER(CSYNC)] csync_update = _libraries['/usr/lib/libocsync.so.0'].csync_update csync_update.restype = c_int csync_update.argtypes = [POINTER(CSYNC)] csync_reconcile = _libraries['/usr/lib/libocsync.so.0'].csync_reconcile csync_reconcile.restype = c_int csync_reconcile.argtypes = [POINTER(CSYNC)] csync_propagate = _libraries['/usr/lib/libocsync.so.0'].csync_propagate csync_propagate.restype = c_int csync_propagate.argtypes = [POINTER(CSYNC)] csync_destroy = _libraries['/usr/lib/libocsync.so.0'].csync_destroy csync_destroy.restype = c_int csync_destroy.argtypes = [POINTER(CSYNC)] csync_version = _libraries['/usr/lib/libocsync.so.0'].csync_version csync_version.restype = STRING csync_version.argtypes = [c_int] csync_add_exclude_list = _libraries['/usr/lib/libocsync.so.0'].csync_add_exclude_list csync_add_exclude_list.restype = c_int csync_add_exclude_list.argtypes = [POINTER(CSYNC), STRING] csync_get_config_dir = _libraries['/usr/lib/libocsync.so.0'].csync_get_config_dir csync_get_config_dir.restype = STRING csync_get_config_dir.argtypes = [POINTER(CSYNC)] csync_set_config_dir = _libraries['/usr/lib/libocsync.so.0'].csync_set_config_dir csync_set_config_dir.restype = c_int csync_set_config_dir.argtypes = [POINTER(CSYNC), STRING] csync_enable_statedb = _libraries['/usr/lib/libocsync.so.0'].csync_enable_statedb csync_enable_statedb.restype = c_int csync_enable_statedb.argtypes = [POINTER(CSYNC)] csync_disable_statedb = _libraries['/usr/lib/libocsync.so.0'].csync_disable_statedb csync_disable_statedb.restype = c_int csync_disable_statedb.argtypes = [POINTER(CSYNC)] csync_is_statedb_disabled = _libraries['/usr/lib/libocsync.so.0'].csync_is_statedb_disabled csync_is_statedb_disabled.restype = c_int csync_is_statedb_disabled.argtypes = [POINTER(CSYNC)] csync_get_userdata = _libraries['/usr/lib/libocsync.so.0'].csync_get_userdata csync_get_userdata.restype = c_void_p csync_get_userdata.argtypes = [POINTER(CSYNC)] csync_set_userdata = _libraries['/usr/lib/libocsync.so.0'].csync_set_userdata csync_set_userdata.restype = c_int csync_set_userdata.argtypes = [POINTER(CSYNC), c_void_p] size_t = c_ulong csync_auth_callback = CFUNCTYPE(c_int, STRING, c_void_p, size_t, c_int, c_int, c_void_p) csync_get_auth_callback = _libraries['/usr/lib/libocsync.so.0'].csync_get_auth_callback csync_get_auth_callback.restype = csync_auth_callback csync_get_auth_callback.argtypes = [POINTER(CSYNC)] csync_set_auth_callback = _libraries['/usr/lib/libocsync.so.0'].csync_set_auth_callback csync_set_auth_callback.restype = c_int csync_set_auth_callback.argtypes = [POINTER(CSYNC), csync_auth_callback] csync_set_log_verbosity = _libraries['/usr/lib/libocsync.so.0'].csync_set_log_verbosity csync_set_log_verbosity.restype = c_int csync_set_log_verbosity.argtypes = [POINTER(CSYNC), c_int] csync_get_log_verbosity = _libraries['/usr/lib/libocsync.so.0'].csync_get_log_verbosity csync_get_log_verbosity.restype = c_int csync_get_log_verbosity.argtypes = [POINTER(CSYNC)] csync_log_callback = CFUNCTYPE(None, POINTER(CSYNC), c_int, STRING, STRING, c_void_p) csync_get_log_callback = _libraries['/usr/lib/libocsync.so.0'].csync_get_log_callback csync_get_log_callback.restype = csync_log_callback csync_get_log_callback.argtypes = [POINTER(CSYNC)] csync_set_log_callback = _libraries['/usr/lib/libocsync.so.0'].csync_set_log_callback csync_set_log_callback.restype = c_int csync_set_log_callback.argtypes = [POINTER(CSYNC), csync_log_callback] csync_get_statedb_file = _libraries['/usr/lib/libocsync.so.0'].csync_get_statedb_file csync_get_statedb_file.restype = STRING csync_get_statedb_file.argtypes = [POINTER(CSYNC)] csync_enable_conflictcopys = _libraries['/usr/lib/libocsync.so.0'].csync_enable_conflictcopys csync_enable_conflictcopys.restype = c_int csync_enable_conflictcopys.argtypes = [POINTER(CSYNC)] csync_set_local_only = _libraries['/usr/lib/libocsync.so.0'].csync_set_local_only csync_set_local_only.restype = c_int csync_set_local_only.argtypes = [POINTER(CSYNC), c_bool] csync_get_local_only = _libraries['/usr/lib/libocsync.so.0'].csync_get_local_only csync_get_local_only.restype = c_bool csync_get_local_only.argtypes = [POINTER(CSYNC)] csync_get_status = _libraries['/usr/lib/libocsync.so.0'].csync_get_status csync_get_status.restype = c_int csync_get_status.argtypes = [POINTER(CSYNC)] csync_set_status = _libraries['/usr/lib/libocsync.so.0'].csync_set_status csync_set_status.restype = c_int csync_set_status.argtypes = [POINTER(CSYNC), c_int] class csync_tree_walk_file_s(Structure): pass TREE_WALK_FILE = csync_tree_walk_file_s csync_treewalk_visit_func = CFUNCTYPE(c_int, POINTER(TREE_WALK_FILE), c_void_p) csync_walk_local_tree = _libraries['/usr/lib/libocsync.so.0'].csync_walk_local_tree csync_walk_local_tree.restype = c_int csync_walk_local_tree.argtypes = [POINTER(CSYNC), POINTER(csync_treewalk_visit_func), c_int] csync_walk_remote_tree = _libraries['/usr/lib/libocsync.so.0'].csync_walk_remote_tree csync_walk_remote_tree.restype = c_int csync_walk_remote_tree.argtypes = [POINTER(CSYNC), POINTER(csync_treewalk_visit_func), c_int] csync_set_iconv_codec = _libraries['/usr/lib/libocsync.so.0'].csync_set_iconv_codec csync_set_iconv_codec.restype = c_int csync_set_iconv_codec.argtypes = [STRING] # values for enumeration 'csync_error_codes_e' CSYNC_ERR_NONE = 0 CSYNC_ERR_LOG = 1 CSYNC_ERR_LOCK = 2 CSYNC_ERR_STATEDB_LOAD = 3 CSYNC_ERR_STATEDB_WRITE = 4 CSYNC_ERR_MODULE = 5 CSYNC_ERR_TIMESKEW = 6 CSYNC_ERR_FILESYSTEM = 7 CSYNC_ERR_TREE = 8 CSYNC_ERR_MEM = 9 CSYNC_ERR_PARAM = 10 CSYNC_ERR_UPDATE = 11 CSYNC_ERR_RECONCILE = 12 CSYNC_ERR_PROPAGATE = 13 CSYNC_ERR_ACCESS_FAILED = 14 CSYNC_ERR_REMOTE_CREATE = 15 CSYNC_ERR_REMOTE_STAT = 16 CSYNC_ERR_LOCAL_CREATE = 17 CSYNC_ERR_LOCAL_STAT = 18 CSYNC_ERR_PROXY = 19 CSYNC_ERR_LOOKUP = 20 CSYNC_ERR_AUTH_SERVER = 21 CSYNC_ERR_AUTH_PROXY = 22 CSYNC_ERR_CONNECT = 23 CSYNC_ERR_TIMEOUT = 24 CSYNC_ERR_HTTP = 25 CSYNC_ERR_PERM = 26 CSYNC_ERR_NOT_FOUND = 27 CSYNC_ERR_EXISTS = 28 CSYNC_ERR_NOSPC = 29 CSYNC_ERR_QUOTA = 30 CSYNC_ERR_SERVICE_UNAVAILABLE = 31 CSYNC_ERR_FILE_TOO_BIG = 32 CSYNC_ERR_ABORTED = 33 CSYNC_ERR_UNSPEC = 34 csync_error_codes_e = c_int # enum CSYNC_ERROR_CODE = csync_error_codes_e csync_get_error = _libraries['/usr/lib/libocsync.so.0'].csync_get_error csync_get_error.restype = CSYNC_ERROR_CODE csync_get_error.argtypes = [POINTER(CSYNC)] csync_get_error_string = _libraries['/usr/lib/libocsync.so.0'].csync_get_error_string csync_get_error_string.restype = STRING csync_get_error_string.argtypes = [POINTER(CSYNC)] csync_set_module_property = _libraries['/usr/lib/libocsync.so.0'].csync_set_module_property csync_set_module_property.restype = c_int csync_set_module_property.argtypes = [POINTER(CSYNC), STRING, c_void_p] # values for enumeration 'csync_notify_type_e' CSYNC_NOTIFY_INVALID = 0 CSYNC_NOTIFY_START_SYNC_SEQUENCE = 1 CSYNC_NOTIFY_START_DOWNLOAD = 2 CSYNC_NOTIFY_START_UPLOAD = 3 CSYNC_NOTIFY_PROGRESS = 4 CSYNC_NOTIFY_FINISHED_DOWNLOAD = 5 CSYNC_NOTIFY_FINISHED_UPLOAD = 6 CSYNC_NOTIFY_FINISHED_SYNC_SEQUENCE = 7 CSYNC_NOTIFY_START_DELETE = 8 CSYNC_NOTIFY_END_DELETE = 9 CSYNC_NOTIFY_ERROR = 10 csync_notify_type_e = c_int # enum csync_progress_callback = CFUNCTYPE(None, STRING, csync_notify_type_e, c_longlong, c_longlong, c_void_p) csync_set_progress_callback = _libraries['/usr/lib/libocsync.so.0'].csync_set_progress_callback csync_set_progress_callback.restype = c_int csync_set_progress_callback.argtypes = [POINTER(CSYNC), csync_progress_callback] __ssize_t = c_long ssize_t = __ssize_t __read_chk = _libraries['/usr/lib/libocsync.so.0'].__read_chk __read_chk.restype = ssize_t __read_chk.argtypes = [c_int, c_void_p, size_t, size_t] read = _libraries['/usr/lib/libocsync.so.0'].read read.restype = ssize_t read.argtypes = [c_int, c_void_p, size_t] __off_t = c_long __pread_chk = _libraries['/usr/lib/libocsync.so.0'].__pread_chk __pread_chk.restype = ssize_t __pread_chk.argtypes = [c_int, c_void_p, size_t, __off_t, size_t] __off64_t = c_long __pread64_chk = _libraries['/usr/lib/libocsync.so.0'].__pread64_chk __pread64_chk.restype = ssize_t __pread64_chk.argtypes = [c_int, c_void_p, size_t, __off64_t, size_t] pread = _libraries['/usr/lib/libocsync.so.0'].pread pread.restype = ssize_t pread.argtypes = [c_int, c_void_p, size_t, __off_t] pread64 = _libraries['/usr/lib/libocsync.so.0'].pread64 pread64.restype = ssize_t pread64.argtypes = [c_int, c_void_p, size_t, __off64_t] __readlink_chk = _libraries['/usr/lib/libocsync.so.0'].__readlink_chk __readlink_chk.restype = ssize_t __readlink_chk.argtypes = [STRING, STRING, size_t, size_t] readlink = _libraries['/usr/lib/libocsync.so.0'].readlink readlink.restype = ssize_t readlink.argtypes = [STRING, STRING, size_t] __readlinkat_chk = _libraries['/usr/lib/libocsync.so.0'].__readlinkat_chk __readlinkat_chk.restype = ssize_t __readlinkat_chk.argtypes = [c_int, STRING, STRING, size_t, size_t] readlinkat = _libraries['/usr/lib/libocsync.so.0'].readlinkat readlinkat.restype = ssize_t readlinkat.argtypes = [c_int, STRING, STRING, size_t] __getcwd_chk = _libraries['/usr/lib/libocsync.so.0'].__getcwd_chk __getcwd_chk.restype = STRING __getcwd_chk.argtypes = [STRING, size_t, size_t] getcwd = _libraries['/usr/lib/libocsync.so.0'].getcwd getcwd.restype = STRING getcwd.argtypes = [STRING, size_t] __getwd_chk = _libraries['/usr/lib/libocsync.so.0'].__getwd_chk __getwd_chk.restype = STRING __getwd_chk.argtypes = [STRING, size_t] getwd = _libraries['/usr/lib/libocsync.so.0'].getwd getwd.restype = STRING getwd.argtypes = [STRING] __confstr_chk = _libraries['/usr/lib/libocsync.so.0'].__confstr_chk __confstr_chk.restype = size_t __confstr_chk.argtypes = [c_int, STRING, size_t, size_t] confstr = _libraries['/usr/lib/libocsync.so.0'].confstr confstr.restype = size_t confstr.argtypes = [c_int, STRING, size_t] __gid_t = c_uint __getgroups_chk = _libraries['/usr/lib/libocsync.so.0'].__getgroups_chk __getgroups_chk.restype = c_int __getgroups_chk.argtypes = [c_int, POINTER(__gid_t), size_t] getgroups = _libraries['/usr/lib/libocsync.so.0'].getgroups getgroups.restype = c_int getgroups.argtypes = [c_int, POINTER(__gid_t)] __ttyname_r_chk = _libraries['/usr/lib/libocsync.so.0'].__ttyname_r_chk __ttyname_r_chk.restype = c_int __ttyname_r_chk.argtypes = [c_int, STRING, size_t, size_t] ttyname_r = _libraries['/usr/lib/libocsync.so.0'].ttyname_r ttyname_r.restype = c_int ttyname_r.argtypes = [c_int, STRING, size_t] __getlogin_r_chk = _libraries['/usr/lib/libocsync.so.0'].__getlogin_r_chk __getlogin_r_chk.restype = c_int __getlogin_r_chk.argtypes = [STRING, size_t, size_t] getlogin_r = _libraries['/usr/lib/libocsync.so.0'].getlogin_r getlogin_r.restype = c_int getlogin_r.argtypes = [STRING, size_t] __gethostname_chk = _libraries['/usr/lib/libocsync.so.0'].__gethostname_chk __gethostname_chk.restype = c_int __gethostname_chk.argtypes = [STRING, size_t, size_t] gethostname = _libraries['/usr/lib/libocsync.so.0'].gethostname gethostname.restype = c_int gethostname.argtypes = [STRING, size_t] __getdomainname_chk = _libraries['/usr/lib/libocsync.so.0'].__getdomainname_chk __getdomainname_chk.restype = c_int __getdomainname_chk.argtypes = [STRING, size_t, size_t] getdomainname = _libraries['/usr/lib/libocsync.so.0'].getdomainname getdomainname.restype = c_int getdomainname.argtypes = [STRING, size_t] getopt = _libraries['/usr/lib/libocsync.so.0'].getopt getopt.restype = c_int getopt.argtypes = [c_int, POINTER(STRING), STRING] class fd_set(Structure): pass class timeval(Structure): pass select = _libraries['/usr/lib/libocsync.so.0'].select select.restype = c_int select.argtypes = [c_int, POINTER(fd_set), POINTER(fd_set), POINTER(fd_set), POINTER(timeval)] class timespec(Structure): pass __time_t = c_long timespec._fields_ = [ ('tv_sec', __time_t), ('tv_nsec', c_long), ] class __sigset_t(Structure): pass __sigset_t._fields_ = [ ('__val', c_ulong * 16), ] pselect = _libraries['/usr/lib/libocsync.so.0'].pselect pselect.restype = c_int pselect.argtypes = [c_int, POINTER(fd_set), POINTER(fd_set), POINTER(fd_set), POINTER(timespec), POINTER(__sigset_t)] gnu_dev_major = _libraries['/usr/lib/libocsync.so.0'].gnu_dev_major gnu_dev_major.restype = c_uint gnu_dev_major.argtypes = [c_ulonglong] gnu_dev_minor = _libraries['/usr/lib/libocsync.so.0'].gnu_dev_minor gnu_dev_minor.restype = c_uint gnu_dev_minor.argtypes = [c_ulonglong] gnu_dev_makedev = _libraries['/usr/lib/libocsync.so.0'].gnu_dev_makedev gnu_dev_makedev.restype = c_ulonglong gnu_dev_makedev.argtypes = [c_uint, c_uint] access = _libraries['/usr/lib/libocsync.so.0'].access access.restype = c_int access.argtypes = [STRING, c_int] euidaccess = _libraries['/usr/lib/libocsync.so.0'].euidaccess euidaccess.restype = c_int euidaccess.argtypes = [STRING, c_int] eaccess = _libraries['/usr/lib/libocsync.so.0'].eaccess eaccess.restype = c_int eaccess.argtypes = [STRING, c_int] faccessat = _libraries['/usr/lib/libocsync.so.0'].faccessat faccessat.restype = c_int faccessat.argtypes = [c_int, STRING, c_int, c_int] lseek = _libraries['/usr/lib/libocsync.so.0'].lseek lseek.restype = __off_t lseek.argtypes = [c_int, __off_t, c_int] lseek64 = _libraries['/usr/lib/libocsync.so.0'].lseek64 lseek64.restype = __off64_t lseek64.argtypes = [c_int, __off64_t, c_int] close = _libraries['/usr/lib/libocsync.so.0'].close close.restype = c_int close.argtypes = [c_int] write = _libraries['/usr/lib/libocsync.so.0'].write write.restype = ssize_t write.argtypes = [c_int, c_void_p, size_t] pwrite = _libraries['/usr/lib/libocsync.so.0'].pwrite pwrite.restype = ssize_t pwrite.argtypes = [c_int, c_void_p, size_t, __off_t] pwrite64 = _libraries['/usr/lib/libocsync.so.0'].pwrite64 pwrite64.restype = ssize_t pwrite64.argtypes = [c_int, c_void_p, size_t, __off64_t] pipe = _libraries['/usr/lib/libocsync.so.0'].pipe pipe.restype = c_int pipe.argtypes = [POINTER(c_int)] pipe2 = _libraries['/usr/lib/libocsync.so.0'].pipe2 pipe2.restype = c_int pipe2.argtypes = [POINTER(c_int), c_int] alarm = _libraries['/usr/lib/libocsync.so.0'].alarm alarm.restype = c_uint alarm.argtypes = [c_uint] sleep = _libraries['/usr/lib/libocsync.so.0'].sleep sleep.restype = c_uint sleep.argtypes = [c_uint] __useconds_t = c_uint ualarm = _libraries['/usr/lib/libocsync.so.0'].ualarm ualarm.restype = __useconds_t ualarm.argtypes = [__useconds_t, __useconds_t] usleep = _libraries['/usr/lib/libocsync.so.0'].usleep usleep.restype = c_int usleep.argtypes = [__useconds_t] pause = _libraries['/usr/lib/libocsync.so.0'].pause pause.restype = c_int pause.argtypes = [] __uid_t = c_uint chown = _libraries['/usr/lib/libocsync.so.0'].chown chown.restype = c_int chown.argtypes = [STRING, __uid_t, __gid_t] fchown = _libraries['/usr/lib/libocsync.so.0'].fchown fchown.restype = c_int fchown.argtypes = [c_int, __uid_t, __gid_t] lchown = _libraries['/usr/lib/libocsync.so.0'].lchown lchown.restype = c_int lchown.argtypes = [STRING, __uid_t, __gid_t] fchownat = _libraries['/usr/lib/libocsync.so.0'].fchownat fchownat.restype = c_int fchownat.argtypes = [c_int, STRING, __uid_t, __gid_t, c_int] chdir = _libraries['/usr/lib/libocsync.so.0'].chdir chdir.restype = c_int chdir.argtypes = [STRING] fchdir = _libraries['/usr/lib/libocsync.so.0'].fchdir fchdir.restype = c_int fchdir.argtypes = [c_int] get_current_dir_name = _libraries['/usr/lib/libocsync.so.0'].get_current_dir_name get_current_dir_name.restype = STRING get_current_dir_name.argtypes = [] dup = _libraries['/usr/lib/libocsync.so.0'].dup dup.restype = c_int dup.argtypes = [c_int] dup2 = _libraries['/usr/lib/libocsync.so.0'].dup2 dup2.restype = c_int dup2.argtypes = [c_int, c_int] dup3 = _libraries['/usr/lib/libocsync.so.0'].dup3 dup3.restype = c_int dup3.argtypes = [c_int, c_int, c_int] execve = _libraries['/usr/lib/libocsync.so.0'].execve execve.restype = c_int execve.argtypes = [STRING, POINTER(STRING), POINTER(STRING)] fexecve = _libraries['/usr/lib/libocsync.so.0'].fexecve fexecve.restype = c_int fexecve.argtypes = [c_int, POINTER(STRING), POINTER(STRING)] execv = _libraries['/usr/lib/libocsync.so.0'].execv execv.restype = c_int execv.argtypes = [STRING, POINTER(STRING)] execle = _libraries['/usr/lib/libocsync.so.0'].execle execle.restype = c_int execle.argtypes = [STRING, STRING] execl = _libraries['/usr/lib/libocsync.so.0'].execl execl.restype = c_int execl.argtypes = [STRING, STRING] execvp = _libraries['/usr/lib/libocsync.so.0'].execvp execvp.restype = c_int execvp.argtypes = [STRING, POINTER(STRING)] execlp = _libraries['/usr/lib/libocsync.so.0'].execlp execlp.restype = c_int execlp.argtypes = [STRING, STRING] execvpe = _libraries['/usr/lib/libocsync.so.0'].execvpe execvpe.restype = c_int execvpe.argtypes = [STRING, POINTER(STRING), POINTER(STRING)] nice = _libraries['/usr/lib/libocsync.so.0'].nice nice.restype = c_int nice.argtypes = [c_int] _exit = _libraries['/usr/lib/libocsync.so.0']._exit _exit.restype = None _exit.argtypes = [c_int] pathconf = _libraries['/usr/lib/libocsync.so.0'].pathconf pathconf.restype = c_long pathconf.argtypes = [STRING, c_int] fpathconf = _libraries['/usr/lib/libocsync.so.0'].fpathconf fpathconf.restype = c_long fpathconf.argtypes = [c_int, c_int] sysconf = _libraries['/usr/lib/libocsync.so.0'].sysconf sysconf.restype = c_long sysconf.argtypes = [c_int] __pid_t = c_int getpid = _libraries['/usr/lib/libocsync.so.0'].getpid getpid.restype = __pid_t getpid.argtypes = [] getppid = _libraries['/usr/lib/libocsync.so.0'].getppid getppid.restype = __pid_t getppid.argtypes = [] getpgrp = _libraries['/usr/lib/libocsync.so.0'].getpgrp getpgrp.restype = __pid_t getpgrp.argtypes = [] __getpgid = _libraries['/usr/lib/libocsync.so.0'].__getpgid __getpgid.restype = __pid_t __getpgid.argtypes = [__pid_t] getpgid = _libraries['/usr/lib/libocsync.so.0'].getpgid getpgid.restype = __pid_t getpgid.argtypes = [__pid_t] setpgid = _libraries['/usr/lib/libocsync.so.0'].setpgid setpgid.restype = c_int setpgid.argtypes = [__pid_t, __pid_t] setpgrp = _libraries['/usr/lib/libocsync.so.0'].setpgrp setpgrp.restype = c_int setpgrp.argtypes = [] setsid = _libraries['/usr/lib/libocsync.so.0'].setsid setsid.restype = __pid_t setsid.argtypes = [] getsid = _libraries['/usr/lib/libocsync.so.0'].getsid getsid.restype = __pid_t getsid.argtypes = [__pid_t] getuid = _libraries['/usr/lib/libocsync.so.0'].getuid getuid.restype = __uid_t getuid.argtypes = [] geteuid = _libraries['/usr/lib/libocsync.so.0'].geteuid geteuid.restype = __uid_t geteuid.argtypes = [] getgid = _libraries['/usr/lib/libocsync.so.0'].getgid getgid.restype = __gid_t getgid.argtypes = [] getegid = _libraries['/usr/lib/libocsync.so.0'].getegid getegid.restype = __gid_t getegid.argtypes = [] group_member = _libraries['/usr/lib/libocsync.so.0'].group_member group_member.restype = c_int group_member.argtypes = [__gid_t] setuid = _libraries['/usr/lib/libocsync.so.0'].setuid setuid.restype = c_int setuid.argtypes = [__uid_t] setreuid = _libraries['/usr/lib/libocsync.so.0'].setreuid setreuid.restype = c_int setreuid.argtypes = [__uid_t, __uid_t] seteuid = _libraries['/usr/lib/libocsync.so.0'].seteuid seteuid.restype = c_int seteuid.argtypes = [__uid_t] setgid = _libraries['/usr/lib/libocsync.so.0'].setgid setgid.restype = c_int setgid.argtypes = [__gid_t] setregid = _libraries['/usr/lib/libocsync.so.0'].setregid setregid.restype = c_int setregid.argtypes = [__gid_t, __gid_t] setegid = _libraries['/usr/lib/libocsync.so.0'].setegid setegid.restype = c_int setegid.argtypes = [__gid_t] getresuid = _libraries['/usr/lib/libocsync.so.0'].getresuid getresuid.restype = c_int getresuid.argtypes = [POINTER(__uid_t), POINTER(__uid_t), POINTER(__uid_t)] getresgid = _libraries['/usr/lib/libocsync.so.0'].getresgid getresgid.restype = c_int getresgid.argtypes = [POINTER(__gid_t), POINTER(__gid_t), POINTER(__gid_t)] setresuid = _libraries['/usr/lib/libocsync.so.0'].setresuid setresuid.restype = c_int setresuid.argtypes = [__uid_t, __uid_t, __uid_t] setresgid = _libraries['/usr/lib/libocsync.so.0'].setresgid setresgid.restype = c_int setresgid.argtypes = [__gid_t, __gid_t, __gid_t] fork = _libraries['/usr/lib/libocsync.so.0'].fork fork.restype = __pid_t fork.argtypes = [] vfork = _libraries['/usr/lib/libocsync.so.0'].vfork vfork.restype = __pid_t vfork.argtypes = [] ttyname = _libraries['/usr/lib/libocsync.so.0'].ttyname ttyname.restype = STRING ttyname.argtypes = [c_int] isatty = _libraries['/usr/lib/libocsync.so.0'].isatty isatty.restype = c_int isatty.argtypes = [c_int] ttyslot = _libraries['/usr/lib/libocsync.so.0'].ttyslot ttyslot.restype = c_int ttyslot.argtypes = [] link = _libraries['/usr/lib/libocsync.so.0'].link link.restype = c_int link.argtypes = [STRING, STRING] linkat = _libraries['/usr/lib/libocsync.so.0'].linkat linkat.restype = c_int linkat.argtypes = [c_int, STRING, c_int, STRING, c_int] symlink = _libraries['/usr/lib/libocsync.so.0'].symlink symlink.restype = c_int symlink.argtypes = [STRING, STRING] symlinkat = _libraries['/usr/lib/libocsync.so.0'].symlinkat symlinkat.restype = c_int symlinkat.argtypes = [STRING, c_int, STRING] unlink = _libraries['/usr/lib/libocsync.so.0'].unlink unlink.restype = c_int unlink.argtypes = [STRING] unlinkat = _libraries['/usr/lib/libocsync.so.0'].unlinkat unlinkat.restype = c_int unlinkat.argtypes = [c_int, STRING, c_int] rmdir = _libraries['/usr/lib/libocsync.so.0'].rmdir rmdir.restype = c_int rmdir.argtypes = [STRING] tcgetpgrp = _libraries['/usr/lib/libocsync.so.0'].tcgetpgrp tcgetpgrp.restype = __pid_t tcgetpgrp.argtypes = [c_int] tcsetpgrp = _libraries['/usr/lib/libocsync.so.0'].tcsetpgrp tcsetpgrp.restype = c_int tcsetpgrp.argtypes = [c_int, __pid_t] getlogin = _libraries['/usr/lib/libocsync.so.0'].getlogin getlogin.restype = STRING getlogin.argtypes = [] setlogin = _libraries['/usr/lib/libocsync.so.0'].setlogin setlogin.restype = c_int setlogin.argtypes = [STRING] sethostname = _libraries['/usr/lib/libocsync.so.0'].sethostname sethostname.restype = c_int sethostname.argtypes = [STRING, size_t] sethostid = _libraries['/usr/lib/libocsync.so.0'].sethostid sethostid.restype = c_int sethostid.argtypes = [c_long] setdomainname = _libraries['/usr/lib/libocsync.so.0'].setdomainname setdomainname.restype = c_int setdomainname.argtypes = [STRING, size_t] vhangup = _libraries['/usr/lib/libocsync.so.0'].vhangup vhangup.restype = c_int vhangup.argtypes = [] revoke = _libraries['/usr/lib/libocsync.so.0'].revoke revoke.restype = c_int revoke.argtypes = [STRING] profil = _libraries['/usr/lib/libocsync.so.0'].profil profil.restype = c_int profil.argtypes = [POINTER(c_ushort), size_t, size_t, c_uint] acct = _libraries['/usr/lib/libocsync.so.0'].acct acct.restype = c_int acct.argtypes = [STRING] getusershell = _libraries['/usr/lib/libocsync.so.0'].getusershell getusershell.restype = STRING getusershell.argtypes = [] endusershell = _libraries['/usr/lib/libocsync.so.0'].endusershell endusershell.restype = None endusershell.argtypes = [] setusershell = _libraries['/usr/lib/libocsync.so.0'].setusershell setusershell.restype = None setusershell.argtypes = [] daemon = _libraries['/usr/lib/libocsync.so.0'].daemon daemon.restype = c_int daemon.argtypes = [c_int, c_int] chroot = _libraries['/usr/lib/libocsync.so.0'].chroot chroot.restype = c_int chroot.argtypes = [STRING] getpass = _libraries['/usr/lib/libocsync.so.0'].getpass getpass.restype = STRING getpass.argtypes = [STRING] fsync = _libraries['/usr/lib/libocsync.so.0'].fsync fsync.restype = c_int fsync.argtypes = [c_int] gethostid = _libraries['/usr/lib/libocsync.so.0'].gethostid gethostid.restype = c_long gethostid.argtypes = [] sync = _libraries['/usr/lib/libocsync.so.0'].sync sync.restype = None sync.argtypes = [] getpagesize = _libraries['/usr/lib/libocsync.so.0'].getpagesize getpagesize.restype = c_int getpagesize.argtypes = [] getdtablesize = _libraries['/usr/lib/libocsync.so.0'].getdtablesize getdtablesize.restype = c_int getdtablesize.argtypes = [] truncate = _libraries['/usr/lib/libocsync.so.0'].truncate truncate.restype = c_int truncate.argtypes = [STRING, __off_t] truncate64 = _libraries['/usr/lib/libocsync.so.0'].truncate64 truncate64.restype = c_int truncate64.argtypes = [STRING, __off64_t] ftruncate = _libraries['/usr/lib/libocsync.so.0'].ftruncate ftruncate.restype = c_int ftruncate.argtypes = [c_int, __off_t] ftruncate64 = _libraries['/usr/lib/libocsync.so.0'].ftruncate64 ftruncate64.restype = c_int ftruncate64.argtypes = [c_int, __off64_t] brk = _libraries['/usr/lib/libocsync.so.0'].brk brk.restype = c_int brk.argtypes = [c_void_p] intptr_t = c_long sbrk = _libraries['/usr/lib/libocsync.so.0'].sbrk sbrk.restype = c_void_p sbrk.argtypes = [intptr_t] syscall = _libraries['/usr/lib/libocsync.so.0'].syscall syscall.restype = c_long syscall.argtypes = [c_long] lockf = _libraries['/usr/lib/libocsync.so.0'].lockf lockf.restype = c_int lockf.argtypes = [c_int, c_int, __off_t] lockf64 = _libraries['/usr/lib/libocsync.so.0'].lockf64 lockf64.restype = c_int lockf64.argtypes = [c_int, c_int, __off64_t] fdatasync = _libraries['/usr/lib/libocsync.so.0'].fdatasync fdatasync.restype = c_int fdatasync.argtypes = [c_int] swab = _libraries['/usr/lib/libocsync.so.0'].swab swab.restype = None swab.argtypes = [c_void_p, c_void_p, ssize_t] ctermid = _libraries['/usr/lib/libocsync.so.0'].ctermid ctermid.restype = STRING ctermid.argtypes = [STRING] time_t = __time_t uid_t = __uid_t gid_t = __gid_t __mode_t = c_uint mode_t = __mode_t # values for enumeration 'csync_ftw_type_e' CSYNC_FTW_TYPE_FILE = 0 CSYNC_FTW_TYPE_SLINK = 1 CSYNC_FTW_TYPE_DIR = 2 CSYNC_FTW_TYPE_SKIP = 3 csync_ftw_type_e = c_int # enum # values for enumeration 'csync_instructions_e' CSYNC_INSTRUCTION_NONE = 0 CSYNC_INSTRUCTION_EVAL = 1 CSYNC_INSTRUCTION_REMOVE = 2 CSYNC_INSTRUCTION_RENAME = 4 CSYNC_INSTRUCTION_NEW = 8 CSYNC_INSTRUCTION_CONFLICT = 16 CSYNC_INSTRUCTION_IGNORE = 32 CSYNC_INSTRUCTION_SYNC = 64 CSYNC_INSTRUCTION_STAT_ERROR = 128 CSYNC_INSTRUCTION_ERROR = 256 CSYNC_INSTRUCTION_DELETED = 512 CSYNC_INSTRUCTION_UPDATED = 1024 csync_instructions_e = c_int # enum csync_tree_walk_file_s._fields_ = [ ('path', STRING), ('modtime', time_t), ('uid', uid_t), ('gid', gid_t), ('mode', mode_t), ('type', csync_ftw_type_e), ('instruction', csync_instructions_e), ('rename_path', STRING), ] csync_s._fields_ = [ ] __suseconds_t = c_long timeval._fields_ = [ ('tv_sec', __time_t), ('tv_usec', __suseconds_t), ] __fd_mask = c_long fd_set._fields_ = [ ('fds_bits', __fd_mask * 16), ] __all__ = ['lseek64', 'lseek', 'CSYNC_ERR_LOCAL_CREATE', 'csync_set_log_callback', 'seteuid', 'CSYNC_ERR_ACCESS_FAILED', 'isatty', 'CSYNC_ERR_TIMESKEW', 'execle', 'csync_is_statedb_disabled', 'truncate64', '__time_t', 'CSYNC_FTW_TYPE_SLINK', 'sleep', 'lockf64', 'mode_t', '__off64_t', 'size_t', 'csync_walk_local_tree', 'getegid', 'csync_error_codes_e', 'group_member', 'CSYNC_ERR_STATEDB_LOAD', 'get_current_dir_name', 'csync_update', 'pause', 'csync_set_auth_callback', 'csync_add_exclude_list', 'getresgid', 'sethostname', 'CSYNC_NOTIFY_PROGRESS', 'CSYNC_ERR_CONNECT', 'CSYNC_ERR_UNSPEC', 'CSYNC_ERR_HTTP', 'fpathconf', '__getpgid', 'csync_set_status', 'lchown', 'setgid', 'csync_get_error', 'CSYNC_ERR_NONE', 'getusershell', 'CSYNC_ERR_LOCAL_STAT', 'CSYNC_INSTRUCTION_NONE', 'CSYNC_NOTIFY_FINISHED_UPLOAD', 'getlogin', 'csync_progress_callback', 'intptr_t', 'csync_walk_remote_tree', 'dup3', 'dup2', 'read', 'getppid', 'CSYNC_INSTRUCTION_REMOVE', 'getdomainname', 'fchown', 'getpgrp', 'CSYNC_NOTIFY_FINISHED_DOWNLOAD', 'CSYNC_NOTIFY_START_DOWNLOAD', 'csync_get_error_string', 'gnu_dev_minor', 'execl', 'readlinkat', 'daemon', 'fsync', 'csync_set_module_property', 'CSYNC_INSTRUCTION_DELETED', 'tcsetpgrp', 'setreuid', 'csync_destroy', 'CSYNC_ERR_PROXY', 'CSYNC_NOTIFY_ERROR', 'getpagesize', 'setlogin', 'execv', 'nice', 'gnu_dev_makedev', 'ttyname', 'linkat', 'getlogin_r', 'CSYNC_ERR_RECONCILE', '__ssize_t', '__confstr_chk', 'CSYNC_ERR_SERVICE_UNAVAILABLE', 'csync_set_config_dir', 'CSYNC_ERR_TIMEOUT', 'sync', '__fd_mask', 'CSYNC_INSTRUCTION_STAT_ERROR', 'getresuid', 'fchownat', '__pid_t', 'execlp', 'csync_get_userdata', 'getgid', 'CSYNC_ERR_TREE', 'CSYNC_ERR_REMOTE_STAT', 'CSYNC_INSTRUCTION_EVAL', '__sigset_t', 'csync_get_log_callback', '__useconds_t', 'CSYNC_ERR_REMOTE_CREATE', 'CSYNC', 'csync_get_config_dir', 'CSYNC_ERR_AUTH_SERVER', 'csync_log_callback', 'access', 'setsid', '__ttyname_r_chk', 'select', 'acct', 'CSYNC_ERR_FILESYSTEM', 'ualarm', 'CSYNC_ERR_MEM', 'revoke', 'csync_s', '__pread64_chk', 'usleep', 'setpgid', 'setresgid', 'getcwd', 'symlink', 'pwrite64', '__getgroups_chk', 'CSYNC_INSTRUCTION_ERROR', 'setregid', 'fchdir', 'ftruncate', 'setegid', 'csync_version', 'CSYNC_FTW_TYPE_DIR', 'CSYNC_INSTRUCTION_IGNORE', 'vhangup', 'getsid', 'csync_notify_type_e', 'CSYNC_INSTRUCTION_RENAME', 'symlinkat', 'CSYNC_ERR_FILE_TOO_BIG', 'pipe2', 'sethostid', 'CSYNC_INSTRUCTION_UPDATED', 'fd_set', 'csync_set_log_verbosity', '_exit', '__readlink_chk', 'endusershell', 'confstr', 'csync_treewalk_visit_func', '__read_chk', '__mode_t', 'swab', 'csync_get_status', 'getpgid', 'brk', '__off_t', 'gethostid', 'pread', '__readlinkat_chk', 'getdtablesize', 'ttyname_r', '__gid_t', 'gethostname', 'timespec', 'CSYNC_ERR_EXISTS', 'faccessat', 'gnu_dev_major', 'rmdir', 'dup', 'csync_propagate', 'fdatasync', 'CSYNC_ERR_PARAM', 'csync_reconcile', '__pread_chk', 'execvpe', 'csync_ftw_type_e', 'eaccess', 'execvp', 'ftruncate64', '__getlogin_r_chk', 'link', 'uid_t', 'csync_set_progress_callback', '__getcwd_chk', 'pselect', 'gid_t', 'CSYNC_ERR_PROPAGATE', 'execve', 'getpass', 'CSYNC_ERR_AUTH_PROXY', 'chdir', '__suseconds_t', 'sbrk', '__getwd_chk', 'CSYNC_INSTRUCTION_SYNC', 'csync_get_statedb_file', 'CSYNC_ERR_NOSPC', 'setresuid', 'csync_auth_callback', 'fexecve', 'vfork', 'setuid', 'fork', 'csync_enable_conflictcopys', 'lockf', 'sysconf', 'syscall', 'csync_set_iconv_codec', 'getwd', 'setdomainname', 'pread64', 'euidaccess', 'close', 'csync_enable_statedb', 'CSYNC_ERR_LOG', 'csync_instructions_e', 'time_t', '__gethostname_chk', 'chroot', 'csync_tree_walk_file_s', 'getgroups', 'TREE_WALK_FILE', 'ssize_t', 'csync_disable_statedb', 'setpgrp', 'timeval', 'write', 'csync_get_auth_callback', 'CSYNC_NOTIFY_START_UPLOAD', 'getopt', 'CSYNC_ERR_LOCK', 'csync_get_log_verbosity', 'CSYNC_FTW_TYPE_FILE', 'CSYNC_ERR_LOOKUP', 'CSYNC_ERR_PERM', 'CSYNC_INSTRUCTION_CONFLICT', 'pathconf', 'csync_set_userdata', 'truncate', 'CSYNC_ERR_NOT_FOUND', 'CSYNC_ERROR_CODE', 'CSYNC_ERR_QUOTA', 'getpid', 'setusershell', 'readlink', 'CSYNC_ERR_MODULE', 'unlink', 'tcgetpgrp', 'unlinkat', '__getdomainname_chk', 'ttyslot', 'pwrite', 'getuid', 'csync_create', 'alarm', 'csync_get_local_only', 'csync_init', 'pipe', 'ctermid', 'chown', 'CSYNC_ERR_UPDATE', 'CSYNC_INSTRUCTION_NEW', 'csync_set_local_only', '__uid_t', 'profil', 'geteuid'] pyowncloud-0.3.1/csync/devel000066400000000000000000000000001224400025400160360ustar00rootroot00000000000000pyowncloud-0.3.1/csync/version.dat000066400000000000000000000001261224400025400172040ustar00rootroot00000000000000{"head": "35e9ab1d31c22c308cad204148d91214c238c80f", "float": 0.3, "string": "0.3.1"} pyowncloud-0.3.1/csync/version.py000066400000000000000000000067611224400025400170770ustar00rootroot00000000000000import 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 self.loadVersion() self.setup() def setup(self): """sublass this to do something useful for yourself""" pass @property def asFloat(self): return self.version['float'] @property def asString(self): return self.version['string'] @property def asHead(self): return self.version['head'] def makeString(self): s = str(self.asFloat) #s = s.replace('.','_') return s def makeNpackd(self): s = "%.2f" % (self.asFloat) return s def makeFloat(self, s): s = str(s) s = s.replace('_', '.') f = float(s) return f def bumpVersion(self, amt=.1): newVersion = self.asFloat + amt self.setVersion(newVersion) def setVersion(self, ver): ver = str(ver) self.version['float'] = self.makeFloat(ver) self.version['string'] = self.makeString() self.asNpackd = self.makeNpackd() self.saveVersion() def loadVersion(self): try: #ver = open(self.verfile,'r').read() ver = json.load(open(self.verfile,'r')) except IOError: ver = {'float': 0.0, 'string': '0.0' } self.version = ver #self.asFloat = self.makeFloat(ver['version']) #self.asString = self.makeString() self.asNpackd = self.makeNpackd() return ver def saveVersion(self): json.dump(self.version,open(self.verfile,'w')) #open(self.verfile,'w').write(str(self.asFloat)) return self.verfile class hgVersion(ver): def getHeadVersion(self): """if hg is around, return the current version and save it otherwise return the saved copy, or 00 if not already saved. """ cmd = "hg heads".split() try: out = subprocess.check_output(cmd) except: out = '\n' out = out.split('\n',1) if 'changeset' in out[0]: out = out[0].split() ver = out[1] self.version['head'] = ver self.saveVersion() else: if self.version.has_key('head'): ver = self.version['head'] else: ver = '00' return ver def setup(self): self.getHeadVersion() @property def asHead(self): return self.getHeadVersion() class gitVersion(ver): def getHeadVersion(self): """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') 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: out = subprocess.check_output(cmd) except: out = '\n' out = out.split('\n',1) if len(out[0]) > 1: ver = out[0] self.version['head'] = ver self.saveVersion() else: if self.version.has_key('head'): ver = self.version['head'] else: ver = '00' return ver def setup(self): self.getHeadVersion() @property 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')) version = ver(verfile) if __name__ == '__main__': print 'Testing version.' v = hgVersion() print 'dict:', v.version print 'string:', v.asString print 'float:', v.asFloat print 'hghead', v.asHead pyowncloud-0.3.1/distribute_setup.py000066400000000000000000000416471224400025400176730ustar00rootroot00000000000000#!python """Bootstrap distribute installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from distribute_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools, set a download mirror, or use an alternate download directory, you can do so by supplying 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: from site import USER_SITE except ImportError: USER_SITE = None try: import subprocess def _python_cmd(*args): args = (sys.executable,) + args return subprocess.call(args) == 0 except ImportError: # will be used for python 2.3 def _python_cmd(*args): args = (sys.executable,) + args # quoting arguments if windows if sys.platform == 'win32': def quote(arg): if ' ' in arg: return '"%s"' % arg return arg args = [quote(arg) for arg in args] return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 DEFAULT_VERSION = "0.6.21" DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" SETUPTOOLS_FAKED_VERSION = "0.6c11" SETUPTOOLS_PKG_INFO = """\ Metadata-Version: 1.0 Name: setuptools Version: %s Summary: xxxx Home-page: xxx Author: xxx Author-email: xxx License: xxx Description: xxx """ % SETUPTOOLS_FAKED_VERSION def _install(tarball, install_args=()): # extracting the tarball tmpdir = tempfile.mkdtemp() log.warn('Extracting in %s', tmpdir) old_wd = os.getcwd() try: os.chdir(tmpdir) tar = tarfile.open(tarball) _extractall(tar) tar.close() # going in the directory subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) os.chdir(subdir) log.warn('Now working in %s', subdir) # installing log.warn('Installing Distribute') 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): # extracting the tarball tmpdir = tempfile.mkdtemp() log.warn('Extracting in %s', tmpdir) old_wd = os.getcwd() try: os.chdir(tmpdir) tar = tarfile.open(tarball) _extractall(tar) tar.close() # going in the directory subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0]) os.chdir(subdir) log.warn('Now working in %s', subdir) # building an egg log.warn('Building a Distribute egg in %s', to_dir) _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir) finally: os.chdir(old_wd) shutil.rmtree(tmpdir) # returning the result log.warn(egg) if not os.path.exists(egg): raise IOError('Could not build the egg.') def _do_download(version, download_base, to_dir, download_delay): egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg' % (version, sys.version_info[0], sys.version_info[1])) if not os.path.exists(egg): tarball = download_setuptools(version, download_base, to_dir, download_delay) _build_egg(egg, tarball, to_dir) sys.path.insert(0, egg) import setuptools setuptools.bootstrap_install_from = egg def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15, no_fake=True): # making sure we use the absolute path to_dir = os.path.abspath(to_dir) was_imported = 'pkg_resources' in sys.modules or \ 'setuptools' in sys.modules try: try: import pkg_resources if not hasattr(pkg_resources, '_distribute'): if not no_fake: _fake_setuptools() raise ImportError except ImportError: return _do_download(version, download_base, to_dir, download_delay) try: pkg_resources.require("distribute>=" + version) return except pkg_resources.VersionConflict: e = sys.exc_info()[1] if was_imported: sys.stderr.write( "The required version of distribute (>=%s) is not available,\n" "and can't be installed while this script is running. Please\n" "install a more recent version first, using\n" "'easy_install -U distribute'." "\n\n(Currently using %r)\n" % (version, e.args[0])) sys.exit(2) else: del pkg_resources, sys.modules['pkg_resources'] # reload ok return _do_download(version, download_base, to_dir, download_delay) except pkg_resources.DistributionNotFound: return _do_download(version, download_base, to_dir, download_delay) finally: 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 `version` should be a valid distribute version number that is available as an egg for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the number of seconds to pause before an actual download attempt. """ # making sure we use the absolute path to_dir = os.path.abspath(to_dir) try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen tgz_name = "distribute-%s.tar.gz" % version url = download_base + tgz_name saveto = os.path.join(to_dir, tgz_name) src = dst = None if not os.path.exists(saveto): # Avoid repeated downloads try: log.warn("Downloading %s", url) src = urlopen(url) # Read/write all in one block, so we don't create a corrupt file # if the download is interrupted. data = src.read() dst = open(saveto, "wb") dst.write(data) finally: if src: src.close() if dst: dst.close() return os.path.realpath(saveto) def _no_sandbox(function): def __no_sandbox(*args, **kw): try: from setuptools.sandbox import DirectorySandbox if not hasattr(DirectorySandbox, '_old'): def violation(*args): pass DirectorySandbox._old = DirectorySandbox._violation DirectorySandbox._violation = violation patched = True else: patched = False except ImportError: patched = False try: return function(*args, **kw) finally: if patched: DirectorySandbox._violation = DirectorySandbox._old del DirectorySandbox._old return __no_sandbox def _patch_file(path, content): """Will backup the file then patch it""" f = open(path) existing_content = f.read() f.close() if existing_content == content: # already patched log.warn('Already patched.') return False log.warn('Patching...') _rename_path(path) f = open(path, 'w') try: f.write(content) finally: f.close() return True _patch_file = _no_sandbox(_patch_file) def _same_content(path, 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 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) return False found = False for file in os.listdir(placeholder): if fnmatch.fnmatch(file, 'setuptools*.egg-info'): found = True break if not found: log.warn('Could not locate setuptools*.egg-info') return 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) else: patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO) if not patched: log.warn('%s already patched.', pkg_info) return False # now let's move the files out of the way for element in ('setuptools', 'pkg_resources.py', 'site.py'): element = os.path.join(placeholder, element) if os.path.exists(element): _rename_path(element) else: log.warn('Could not find the %s element of the ' 'Setuptools distribution', element) return True _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') return pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1]) setuptools_file = 'setuptools-%s-py%s.egg-info' % \ (SETUPTOOLS_FAKED_VERSION, pyver) pkg_info = os.path.join(placeholder, setuptools_file) if os.path.exists(pkg_info): log.warn('%s already exists', pkg_info) return log.warn('Creating %s', pkg_info) 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: f.close() pth_file = os.path.join(placeholder, 'setuptools.pth') log.warn('Creating %s', pth_file) f = open(pth_file, 'w') try: f.write(os.path.join(os.curdir, setuptools_file)) finally: f.close() _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 pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') if os.path.exists(pkg_info): if _same_content(pkg_info, SETUPTOOLS_PKG_INFO): log.warn('%s already patched.', pkg_info) return False _rename_path(path) os.mkdir(path) os.mkdir(os.path.join(path, 'EGG-INFO')) pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') f = open(pkg_info, 'w') try: f.write(SETUPTOOLS_PKG_INFO) finally: f.close() return True _patch_egg_dir = _no_sandbox(_patch_egg_dir) def _before_install(): log.warn('Before install bootstrap.') _fake_setuptools() def _under_prefix(location): if 'install' not in sys.argv: return True args = sys.argv[sys.argv.index('install') + 1:] for index, arg in enumerate(args): for option in ('--root', '--prefix'): if arg.startswith('%s=' % option): top_dir = arg.split('root=')[-1] return location.startswith(top_dir) elif arg == option: if len(args) > index: top_dir = args[index + 1] return location.startswith(top_dir) if arg == '--user' and USER_SITE is not None: return location.startswith(USER_SITE) return True def _fake_setuptools(): log.warn('Scanning installed packages') try: import pkg_resources except ImportError: # we're cool log.warn('Setuptools or Distribute does not seem to be installed.') return ws = pkg_resources.working_set try: 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') ) if setuptools_dist is None: log.warn('No setuptools distribution found') return # detecting if it was already faked setuptools_location = setuptools_dist.location log.warn('Setuptools installation detected at %s', setuptools_location) # if --root or --preix was provided, and if # setuptools is not located in them, we don't patch it if not _under_prefix(setuptools_location): log.warn('Not patching, --root or --prefix is installing Distribute' ' in another location') return # let's see if its an egg if not setuptools_location.endswith('.egg'): log.warn('Non-egg installation') res = _remove_flat_installation(setuptools_location) if not res: return else: log.warn('Egg installation') pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO') if (os.path.exists(pkg_info) and _same_content(pkg_info, SETUPTOOLS_PKG_INFO)): log.warn('Already patched.') return log.warn('Patching...') # let's create a fake egg replacing setuptools one res = _patch_egg_dir(setuptools_location) if not res: return log.warn('Patching complete.') _relaunch() def _relaunch(): log.warn('Relaunching...') # we have to relaunch the process # pip marker to avoid a relaunch bug _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)) def _extractall(self, path=".", members=None): """Extract all members from the archive to the current working directory and set owner, modification time and permissions on directories afterwards. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by getmembers(). """ import copy import operator from tarfile import ExtractError directories = [] if members is None: members = self for tarinfo in members: if tarinfo.isdir(): # Extract directories with a safe mode. directories.append(tarinfo) tarinfo = copy.copy(tarinfo) tarinfo.mode = 448 # decimal for oct 0700 self.extract(tarinfo, path) # Reverse sort directories. if sys.version_info < (2, 4): def sorter(dir1, dir2): return cmp(dir1.name, dir2.name) directories.sort(sorter) directories.reverse() else: directories.sort(key=operator.attrgetter('name'), reverse=True) # Set correct owner, mtime and filemode on directories. for tarinfo in directories: dirpath = os.path.join(path, tarinfo.name) try: self.chown(tarinfo, dirpath) self.utime(tarinfo, dirpath) self.chmod(tarinfo, dirpath) except ExtractError: e = sys.exc_info()[1] if self.errorlevel > 1: raise else: self._dbg(1, "tarfile: %s" % e) 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""" options = _parse_args() tarball = download_setuptools(download_base=options.download_base) return _install(tarball, _build_install_args(options)) if __name__ == '__main__': sys.exit(main()) pyowncloud-0.3.1/doc/000077500000000000000000000000001224400025400144545ustar00rootroot00000000000000pyowncloud-0.3.1/doc/asciidoc.conf000066400000000000000000000002701224400025400171000ustar00rootroot00000000000000# # Customization for csync documentation. # [specialwords] ifndef::doctype-manpage[] emphasizedwords=(?u)\\?\bOCLIENT\b monospacedwords=(?u)\\?\boclient\(1\) endif::doctype-manpage[] pyowncloud-0.3.1/doc/makeman.sh000077500000000000000000000002751224400025400164300ustar00rootroot00000000000000#!/bin/bash # Last Change: 2008-07-03 11:08:54 for f in doc/*1.txt; do echo -e "\e[32mCreating manpage ${f%.*}\e[0m" a2x --doctype=manpage --format=manpage $f rm -f ${f%.*}.xml done pyowncloud-0.3.1/doc/oclient.1000066400000000000000000000117761224400025400162070ustar00rootroot00000000000000'\" t .\" Title: oclient .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 11/18/2013 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" .TH "OCLIENT" "1" "11/18/2013" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" oclient \- ownCloud CLI client written in python .SH "SYNOPSIS" .sp \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] [\-\-downloadlimit \fIDOWNLOADLIMIT\fR] [\-\-uploadlimit \fIUPLOADLIMIT\fR] .SH "DESCRIPTION" .sp Syncing files across machines using ownCloud DAV server\&. .PP \fBPassword options:\fR .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} You can specify on the cmd line: \fB\-p\fR (not very safe) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} In the environment variable: \fIOCPASS\fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} In the owncloud\&.cfg file as \fBpass = \fR\fB\fI\fR\fR .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Use keyring to store passwords in a keyring (needs Python Keyring Lib to be installed) .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Do none of the above, and it will prompt you for the password .RE .sp The choice is yours, if you put it in the cfg file, be careful to make sure nobody but you can read the file\&. (0400/0600 file perms)\&. .SH "OPTIONS" .PP \fB\-c \fR\fB\fICONFIG\fR\fR\fB, \-\-config \fR\fB\fICONFIG\fR\fR .RS 4 Configuration file to use .RE .PP \fB\-u \fR\fB\fIUSER\fR\fR\fB, \-\-user \fR\fB\fIUSER\fR\fR .RS 4 Username on the ownCloud server .RE .PP \fB\-p \fR\fB\fIPASS\fR\fR\fB, \-\-pass \fR\fB\fIPASS\fR\fR .RS 4 Password on the ownCloud server ( You can also store this in environment variable \fIOCPASS\fR ) .RE .PP \fB\-s \fR\fB\fISRC\fR\fR\fB, \-\-src \fR\fB\fISRC\fR\fR .RS 4 Local directory to sync against .RE .PP \fB\-d \fR\fB\fIDST\fR\fR\fB, \-\-dst \fR\fB\fIDST\fR\fR .RS 4 Folder on server to sync against .RE .PP \fB\-\-url \fR\fB\fIURL\fR\fR .RS 4 URL of the ownCloud server .RE .PP \fB\-\-ssl \fR\fB\fISSLFINGERPRINT\fR\fR .RS 4 Valid SSL fingerprint for the ownCloud server .RE .PP \fB\-\-use\-keyring\fR .RS 4 Use keyring if available to store password safely (Needs Python Keyring Lib to be installed) .RE .PP \fB\-\-downloadlimit \fR\fB\fIDOWNLOADLIMIT\fR\fR .RS 4 Download limit in KB/s\&. .RE .PP \fB\-\-uploadlimit \fR\fB\fIUPLOADLIMIT\fR\fR .RS 4 Upload limit in KB/s\&. .RE .PP \fB\-\-dry\-run\fR .RS 4 Dry Run, do not actually execute command .RE .PP \fB\-\-debug\fR .RS 4 Print a bunch of debug info .RE .PP \fB\-h, \-\-help\fR .RS 4 Show help message and exit .RE .PP \fB\-v, \-\-version\fR .RS 4 show program\(cqs version number and exit .RE .SH "CONFIGURATION FILE" .sp 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 \fBuser\fR .RS 4 username on the ownCloud server .RE .PP \fBpass\fR .RS 4 password on the ownCloud server .RE .PP \fBurl\fR .RS 4 url of the ownCloud server .RE .PP \fBsslfingerprint\fR .RS 4 valid SSL fingerprint for the ownCloud server .RE .PP \fBsrc\fR .RS 4 local directory to sync against .RE .PP \fBdst\fR .RS 4 folder on the server to sync against .RE .sp A complete example: .sp .if n \{\ .RS 4 .\} .nf [ownCloud] user=awesomeSauce pass=PasswordThisIsSuperSuperSecretReallyISwearLOL url=https://www\&.example\&.org/owncloud/ sslfingerprint= src=/home/awesomeSauce/ownCloud dst=clientsync .fi .if n \{\ .RE .\} .SH "BUGS" .sp Please report bugs at https://github\&.com/csawyerYumaed/pyOwnCloud/issues\&. .SH "SEE ALSO" .sp \fBlibcsync\fR(7) .SH "AUTHORS" .sp pyOwnCloud Team .SH "COPYING" .sp Copyright (c) 2013 pyOwnCloud Team\&. Free use of this software is granted under the terms of the GNU General Public License 2 (GPL\-2)\&. pyowncloud-0.3.1/doc/oclient.1.txt000066400000000000000000000056741224400025400170250ustar00rootroot00000000000000oclient(1) ======== NAME ---- oclient - ownCloud CLI client written in python SYNOPSIS -------- *oclient* [-h] [-v] [-c 'CONFIG'] [-u 'USER'] [--ssl 'SSLFINGERPRINT'] [-p 'PASS'] [--dry-run] [--debug] [-s 'SRC'] [-d 'DST'] [--url 'URL'] [--use-keyring] [--downloadlimit 'DOWNLOADLIMIT'] [--uploadlimit 'UPLOADLIMIT'] DESCRIPTION ----------- Syncing files across machines using ownCloud DAV server. .Password options: - You can specify on the cmd line: *-p* (not very safe) - In the environment variable: 'OCPASS' - In the owncloud.cfg file as *pass = ''* - Use keyring to store passwords in a keyring (needs Python Keyring Lib to be installed) - Do none of the above, and it will prompt you for the password The choice is yours, if you put it in the cfg file, be careful to make sure nobody but you can read the file. (0400/0600 file perms). OPTIONS ------- *-c 'CONFIG', --config 'CONFIG'*:: Configuration file to use *-u 'USER', --user 'USER'*:: Username on the ownCloud server *-p 'PASS', --pass 'PASS'*:: Password on the ownCloud server ( You can also store this in environment variable 'OCPASS' ) *-s 'SRC', --src 'SRC'*:: Local directory to sync against *-d 'DST', --dst 'DST'*:: Folder on server to sync against *--url 'URL'*:: URL of the ownCloud server *--ssl 'SSLFINGERPRINT'*:: Valid SSL fingerprint for the ownCloud server *--use-keyring*:: Use keyring if available to store password safely (Needs Python Keyring Lib to be installed) *--downloadlimit 'DOWNLOADLIMIT'*:: Download limit in KB/s. *--uploadlimit 'UPLOADLIMIT'*:: Upload limit in KB/s. *--dry-run*:: Dry Run, do not actually execute command *--debug*:: Print a bunch of debug info *-h, --help*:: Show help message and exit *-v, --version*:: show program's version number and exit CONFIGURATION FILE ------------------ 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: *user*:: username on the ownCloud server *pass*:: password on the ownCloud server *url*:: url of the ownCloud server *sslfingerprint*:: valid SSL fingerprint for the ownCloud server *src*:: local directory to sync against *dst*:: folder on the server to sync against A complete example: [ownCloud] user=awesomeSauce pass=PasswordThisIsSuperSuperSecretReallyISwearLOL url=https://www.example.org/owncloud/ sslfingerprint= src=/home/awesomeSauce/ownCloud dst=clientsync BUGS ---- Please report bugs at https://github.com/csawyerYumaed/pyOwnCloud/issues. SEE ALSO -------- *libcsync*(7) AUTHORS ------- pyOwnCloud Team COPYING ------- Copyright (c) 2013 pyOwnCloud Team. Free use of this software is granted under the terms of the GNU General Public License 2 (GPL-2). pyowncloud-0.3.1/pre-commit000077500000000000000000000006211224400025400157100ustar00rootroot00000000000000#!/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.version import gitVersion,verfile; gitVersion(verfile).setup()' pyowncloud-0.3.1/setup.py000066400000000000000000000017361224400025400154300ustar00rootroot00000000000000from distribute_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages import csync.version as ver setup( name = "pyOwnCloud", version = ver.version.asString, packages = find_packages(), package_data = { 'csync': [ 'version.dat'], }, entry_points = { 'console_scripts': [ 'oclient = csync.csync:main', ], }, extras_require = { 'keyring': ["keyring"], }, author = 'pyOwnCloud Team', author_email = 'pyowncloud@lists.cknow.org', license = 'GPLv2', url = "https://github.com/csawyerYumaed/pyOwnCloud", description = 'ownCloud CLI client- connect your ownCloud with python.', long_description = open('README.md').read(), classifiers = [ "Development Status :: 3 - Alpha", "Environment :: Console", "Topic :: Communications :: File Sharing", "Intended Audience :: End Users/Desktop", "Programming Language :: Python", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", ] ) # vim: noet:ts=4:sw=4:sts=4