Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update name references as per #2 #10

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ tests/clitest.sh || err "CLI tests failed";
confirm "Continue with release of v$VERSION?" || exit 0;


echo "RELEASE JOTTALIB AND JOTTACLOUDCLIENT VERSION $VERSION:"
echo "RELEASE JOTTALIB-NG AND JOTTACLOUDCLIENT VERSION $VERSION:"
echo "=======================";
printf "Uploading cheese to pypi";
printf "... jottalib ";
python setup.py sdist bdist_wheel upload || err "jottalib setup.py upload failed";
python setup.py sdist bdist_wheel upload || err "jottalib-ng setup.py upload failed";
echo "=======================";
echo "Creating git tag $VERSION and pushing it to git server";
git tag -a "v$VERSION" -m "Version $VERSION release" || err "couldnt tag git tree";
git push --tags || err "problems pushing tags to central repository";
echo "=======================";
echo "Creating docs with pdoc";
(cd src; pdoc --overwrite --html-dir ../dist/docs/"$VERSION"/ --html jottalib;) || err "pdoc generating docs failed";
(cd src; pdoc --overwrite --html-dir ../dist/docs/"$VERSION"/ --html jottalib-ng;) || err "pdoc generating docs failed";
echo "=======================";
echo "Uploading docs to pypi";
python setup.py upload_docs --upload-dir dist/docs/"$VERSION"/jottalib || err "couldnt upload docs to pypi";
python setup.py upload_docs --upload-dir dist/docs/"$VERSION"/jottalib-ng || err "couldnt upload docs to pypi";
echo "=======================";
echo "Enjoy your fresh $VERSION release!"

34 changes: 17 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# encoding: utf-8
#
# This file is part of jottalib.
# This file is part of jottalib_ng.
#
# jottafs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -27,7 +27,7 @@
#sys.path.insert(0, './src')

# get metadata (__version__, etc) from module magic
with open(os.path.join('src', 'jottalib', '__init__.py')) as f:
with open(os.path.join('src', 'jottalib_ng', '__init__.py')) as f:
metadata = dict(re.findall("__([a-z]+)__\s*=\s*'([^']+)'", f.read()))

try:
Expand Down Expand Up @@ -60,34 +60,34 @@
EXTRAS['FUSE'].append('fusepy')
EXTRAS['Qt'].append('python-qt4')
else:
print('WARNING: jottalib requires `lxml`, please get it from http://www.lfd.uci.edu/~gohlke/pythonlibs/')
print('WARNING: jottalib_ng requires `lxml`, please get it from http://www.lfd.uci.edu/~gohlke/pythonlibs/')


setup(name='jottalib',
setup(name='jottalib-ng',
version=metadata['version'],
license='GPLv3',
description='A library and tools to access the JottaCloud API',
long_description=long_desc,
author=u'Håvard Gulldahl',
author_email='havard@gulldahl.no',
url='https://github.com/havardgulldahl/jottalib',
url='https://github.com/Fjodor42/jottalib-ng',
package_dir={'':'src'},
packages=['jottalib', 'jottalib.contrib'],
packages=['jottalib_ng', 'jottalib_ng.contrib'],
install_requires=REQUIRES,
extras_require=EXTRAS,
entry_points={
'console_scripts': [
'jotta-download = jottalib.cli:download',
'jotta-fuse = jottalib.cli:fuse',
'jotta-ls = jottalib.cli:ls',
'jotta-mkdir = jottalib.cli:mkdir',
'jotta-restore = jottalib.cli:restore',
'jotta-rm = jottalib.cli:rm',
'jotta-share = jottalib.cli:share',
'jotta-upload = jottalib.cli:upload',
'jotta-scanner = jottalib.cli:scanner',
'jotta-monitor = jottalib.cli:monitor',
'jotta-cat = jottalib.cli:cat',
'jotta-download = jottalib_ng.cli:download',
'jotta-fuse = jottalib_ng.cli:fuse',
'jotta-ls = jottalib_ng.cli:ls',
'jotta-mkdir = jottalib_ng.cli:mkdir',
'jotta-restore = jottalib_ng.cli:restore',
'jotta-rm = jottalib_ng.cli:rm',
'jotta-share = jottalib_ng.cli:share',
'jotta-upload = jottalib_ng.cli:upload',
'jotta-scanner = jottalib_ng.cli:scanner',
'jotta-monitor = jottalib_ng.cli:monitor',
'jotta-cat = jottalib_ng.cli:cat',
]
},
classifiers="""Intended Audience :: Developers
Expand Down
26 changes: 13 additions & 13 deletions src/duplicity-backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ def get_root_dir(jfs):
return root_dir


def set_jottalib_logging_level(log_level):
logger = logging.getLogger('jottalib')
def set_jottalib_ng_logging_level(log_level):
logger = logging.getLogger('jottalib_ng')
logger.setLevel(getattr(logging, log_level))


def set_jottalib_log_handlers(handlers):
logger = logging.getLogger('jottalib')
def set_jottalib_ng_log_handlers(handlers):
logger = logging.getLogger('jottalib_ng')
for handler in handlers:
logger.addHandler(handler)

Expand All @@ -75,17 +75,17 @@ def __init__(self, parsed_url):

# Import JottaCloud libraries.
try:
from jottalib import JFS
from jottalib_ng import JFS
except ImportError:
raise BackendException('JottaCloud backend requires jottalib'
' (see https://pypi.python.org/pypi/jottalib).')
raise BackendException('JottaCloud backend requires jottalib_ng'
' (see https://pypi.python.org/pypi/jottalib_ng).')

# Set jottalib loggers to the same verbosity as duplicity
# Set jottalib_ng loggers to the same verbosity as duplicity
duplicity_log_level = get_duplicity_log_level()
set_jottalib_logging_level(duplicity_log_level)
set_jottalib_ng_logging_level(duplicity_log_level)

# Ensure jottalib and duplicity log to the same handlers
set_jottalib_log_handlers(log._logger.handlers)
# Ensure jottalib_ng and duplicity log to the same handlers
set_jottalib_ng_log_handlers(log._logger.handlers)

# Will fetch jottacloud auth from environment or .netrc
self.client = JFS.JFS()
Expand All @@ -95,7 +95,7 @@ def __init__(self, parsed_url):


def get_or_create_directory(self, directory_name):
from jottalib.JFS import JFSNotFoundError
from jottalib_ng.JFS import JFSNotFoundError
root_directory = get_root_dir(self.client)
full_path = posixpath.join(root_directory.path, directory_name)
try:
Expand Down Expand Up @@ -144,7 +144,7 @@ def _query(self, filename):
# - Return a dict with a 'size' key, and a file size value (-1 for not found)
# - Retried if an exception is thrown
log.Info('Querying size of %s' % filename)
from jottalib.JFS import JFSNotFoundError, JFSIncompleteFile
from jottalib_ng.JFS import JFSNotFoundError, JFSIncompleteFile
remote_path = posixpath.join(self.folder.path, filename)
try:
remote_file = self.client.getObject(remote_path)
Expand Down
4 changes: 2 additions & 2 deletions src/jottalib/JFS.py → src/jottalib_ng/JFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# metadata

__author__ = 'havard@gulldahl.no'
from jottalib import __version__
from jottalib_ng import __version__

# importing stdlib
import sys, os, os.path, time
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def __init__(self, auth=None):
self.username, password = auth
self.session.auth = HTTPBasicAuth(self.username, password)
self.session.verify = certifi.where()
self.session.headers = {'User-Agent':'jottalib %s (https://github.com/havardgulldahl/jottalib)' % (__version__, ),
self.session.headers = {'User-Agent':'jottalib_ng %s (https://github.com/Fjodor42/jottalib-ng)' % (__version__, ),
'X-JottaAPIVersion': self.apiversion,
}
self.rootpath = JFS_ROOT + self.username
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/jottalib/cli.py → src/jottalib_ng/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import codecs

# import our stuff
from jottalib import JFS, __version__
from jottalib_ng import JFS, __version__
from .scanner import filescanner

# helper functions
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def func(*args, **kwargs):

#
#
# This stuff added by the jottalib project, under the same terms as above (PSF License)
# This stuff added by the jottalib_ng project, under the same terms as above (PSF License)
#

class Memoize(MWT):
Expand Down
File renamed without changes.
File renamed without changes.
26 changes: 13 additions & 13 deletions src/jottalib/jottacloud.py → src/jottalib_ng/jottacloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
except ImportError: # no xattr installed, not critical because it is optional
HAS_XATTR=False

import jottalib
from jottalib.JFS import JFSNotFoundError, \
import jottalib_ng
from jottalib_ng.JFS import JFSNotFoundError, \
JFSFolder, JFSFile, JFSIncompleteFile, JFSFileDirList, \
calculate_md5

Expand Down Expand Up @@ -268,9 +268,9 @@ def setxattrhash(filename, md5hash):
return False
try:
x = xattr(filename)
x.set('user.jottalib.md5', md5hash.encode('utf-8'))
x.set('user.jottalib.timestamp', str(os.path.getmtime(filename)).encode('utf-8'))
x.set('user.jottalib.filesize', str(os.path.getsize(filename)).encode('utf-8'))
x.set('user.jottalib_ng.md5', md5hash.encode('utf-8'))
x.set('user.jottalib_ng.timestamp', str(os.path.getmtime(filename)).encode('utf-8'))
x.set('user.jottalib_ng.filesize', str(os.path.getsize(filename)).encode('utf-8'))
return True
except IOError:
# no file system support
Expand All @@ -287,15 +287,15 @@ def getxattrhash(filename):
return None
try:
x = xattr(filename)
print(x.get('user.jottalib.filesize'))
print(x.get('user.jottalib.timestamp'))
print(x.get('user.jottalib.md5'))
if x.get('user.jottalib.filesize').decode('utf-8') != str(os.path.getsize(filename)) or x.get('user.jottalib.timestamp').decode('utf-8') != str(os.path.getmtime(filename)):
x.remove('user.jottalib.filesize')
x.remove('user.jottalib.timestamp')
x.remove('user.jottalib.md5')
print(x.get('user.jottalib_ng.filesize'))
print(x.get('user.jottalib_ng.timestamp'))
print(x.get('user.jottalib_ng.md5'))
if x.get('user.jottalib_ng.filesize').decode('utf-8') != str(os.path.getsize(filename)) or x.get('user.jottalib_ng.timestamp').decode('utf-8') != str(os.path.getmtime(filename)):
x.remove('user.jottalib_ng.filesize')
x.remove('user.jottalib_ng.timestamp')
x.remove('user.jottalib_ng.md5')
return None # this is not the file we have calculated md5 for
return x.get('user.jottalib.md5').decode('utf-8')
return x.get('user.jottalib_ng.md5').decode('utf-8')
except Exception as e:
log.debug('setxattr got exception %r', e)
return None
4 changes: 2 additions & 2 deletions src/jottalib/jottafuse.py → src/jottalib_ng/jottafuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
log = logging.getLogger(__name__)

# import jotta
from jottalib import JFS, __version__
from jottalib.contrib.mwt import Memoize
from jottalib_ng import JFS, __version__
from jottalib_ng.contrib.mwt import Memoize

# import dependenceis (get them with pip!)
try:
Expand Down
14 changes: 7 additions & 7 deletions src/jottalib/monitor.py → src/jottalib_ng/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

"""
#
# This file is part of jottalib.
# This file is part of jottalib_ng.
#
# jottalib is free software: you can redistribute it and/or modify
# jottalib_ng 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 3 of the License, or
# (at your option) any later version.
#
# jottalib is distributed in the hope that it will be useful,
# jottalib_ng 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 jottalib. If not, see <http://www.gnu.org/licenses/>.
# along with jottalib_ng. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2015 Håvard Gulldahl <havard@gulldahl.no>

Expand All @@ -31,9 +31,9 @@

from clint.textui import progress, puts, colored

from jottalib.JFS import JFS
from jottalib import jottacloud, __version__
from jottalib.contrib.readlnk import readlnk
from jottalib_ng.JFS import JFS
from jottalib_ng import jottacloud, __version__
from jottalib_ng.contrib.readlnk import readlnk



Expand Down
6 changes: 3 additions & 3 deletions src/jottalib/qt.py → src/jottalib_ng/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

logging.getLogger(__name__)

# Part of jottalib.
import jottalib.JFS as JFS
# Part of jottalib_ng.
import jottalib_ng.JFS as JFS

# This is only needed for Python v2 but is harmless for Python v3.
import sip
Expand Down Expand Up @@ -89,7 +89,7 @@ class JFSModel(QtGui.QStandardItemModel):

def __init__(self, jfs, rootPath, parent=None):
super(JFSModel, self).__init__(parent)
self.jfs = jfs # a jottalib.JFS.JFS instance
self.jfs = jfs # a jottalib_ng.JFS.JFS instance
self.rootItem = self.invisibleRootItem() # top item
self.rootPath = rootPath
rawObj = self.jfs.getObject(self.rootPath)
Expand Down
4 changes: 2 additions & 2 deletions src/jottalib/scanner.py → src/jottalib_ng/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#import pip modules
from clint.textui import progress, puts, colored

#import jottalib
from jottalib.JFS import JFS
#import jottalib_ng
from jottalib_ng.JFS import JFS
from . import jottacloud, __version__


Expand Down
10 changes: 5 additions & 5 deletions tests/sansrequests.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- encoding: utf-8 -*-
'Speed test jottalib without requests, only urllib3'
'Speed test jottalib_ng without requests, only urllib3'
#
# This file is part of jottalib.
# This file is part of jottalib_ng.
#
# jottalib is free software: you can redistribute it and/or modify
# jottalib_ng 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 3 of the License, or
# (at your option) any later version.
#
# jottalib is distributed in the hope that it will be useful,
# jottalib_ng 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.
Expand Down Expand Up @@ -56,7 +56,7 @@ def __init__(self, username, password):
ca_certs=certifi.where())
self.username = username
self.headers = urllib3.util.make_headers(basic_auth='%s:%s' % (username, password))
self.headers.update({'User-Agent':'jottalib %s (https://github.com/havardgulldahl/jottalib)' % (__version__, ),
self.headers.update({'User-Agent':'jottalib_ng %s (https://github.com/Fjodor42/jottalib-ng)' % (__version__, ),
'X-JottaAPIVersion': self.apiversion,
})
def get(self, path):
Expand Down
14 changes: 7 additions & 7 deletions tests/speedtest.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- encoding: utf-8 -*-
'Speed test jottalib'
'Speed test jottalib_ng'
#
# This file is part of jottalib.
# This file is part of jottalib_ng.
#
# jottalib is free software: you can redistribute it and/or modify
# jottalib_ng 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 3 of the License, or
# (at your option) any later version.
#
# jottalib is distributed in the hope that it will be useful,
# jottalib_ng 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.
Expand All @@ -35,7 +35,7 @@


# import jotta
from jottalib import JFS, __version__
from jottalib_ng import JFS, __version__
from sansrequests import JFS as LiteJFS

def humanizeFileSize(size):
Expand Down Expand Up @@ -101,7 +101,7 @@ def UP(monitor, total):
puts(colored.magenta("Network download speed %s/sec \n" % ( humanizeFileSize( (filesize / (_end-_start)) ) )))

# TODO: PRINT STATS IN A TABLE FOR COMPARISON / BOOKKEEPING
# Versions: jottalib, urllib3, requests, jottaAPI
# Versions: jottalib_ng, urllib3, requests, jottaAPI
# Server version from jottacloud.com

# TEST WITHOUR REQUESTS, ONLY urllib3
Expand Down Expand Up @@ -138,7 +138,7 @@ def UP(monitor, total):
_end = time.time()
puts(colored.magenta("Network download speed %s/sec" % ( humanizeFileSize( (filesize / (_end-_start)) ) )))

# CLEANUP JOTTALIB
# CLEANUP JOTTALIB-NG
fileobj.delete()

#
Expand Down
Loading