Commits

Miki Tebeka committed daf462c

versioning

  • Participants
  • Parent commits b39ae6d

Comments (0)

Files changed (4)

 except ImportError:
     from distutils.core import setup
 
+import webhdfs
+
 setup(
     name='webhdfs',
-    version='0.1.0',
+    version=webhdfs.__version__,
     description='WebHDFS client',
     long_description=open('README.rst').read(),
     author='Miki Tebeka',
 
 from webhdfs import WebHDFS
 
-conn = WebHDFS('192.168.1.134', user='hdfs')
+conn = WebHDFS('192.168.1.143', user='hdfs')
 remote = '/tmp/z138'
-# print('listdir')
-# print(conn.listdir('/tmp'))
-# print('stat')
-# print(conn.stat(remote))
-# print('checksum')
-# print(conn.checksum(remote))
-# print('home')
-# print(conn.home())
-# print('chmod')
-# conn.chmod(0o777, remote)
-# print('chown')
-# conn.chown('cloudera', remote)
-# print('open')
-# print(conn.read(remote).decode('utf-8'))
-# print('put')
-# conn.put('README.rst', remote, overwrite=True)
-# print('append')
-# conn.append(__file__, remote)
-# print('mkdir')
-# print(conn.mkdir('/tmp/zolo'))
-# print('rename')
-# print(conn.rename(remote, '/tmp/8z'))
-# print('delete')
-# print(conn.delete('/tmp/8z'))
+new = '/tmp/8z'
+print('put')
+conn.put('README.rst', remote, overwrite=True)
+print('listdir')
+print(conn.listdir('/tmp'))
+print('stat')
+print(conn.stat(remote))
+print('checksum')
+print(conn.checksum(remote))
+print('home')
+print(conn.home())
+print('chmod')
+conn.chmod(0o777, remote)
+print('chown')
+conn.chown('cloudera', remote)
+print('open')
+print(conn.read(remote).decode('utf-8'))
+print('append')
+conn.append(__file__, remote)
+print('mkdir')
+print(conn.mkdir('/tmp/zolo'))
+print('rename')
+print(conn.rename(remote, new))
+print('delete')
+print(conn.delete(new))

File webhdfs/__init__.py

 import sys
 from os.path import isfile
 
+__version__ = '0.1.0'
+
 if sys.version_info[0] > 2:
     from urllib.parse import urlparse, urlencode
 else:

File webhdfs/__main__.py

 #!/usr/bin/env python
 
-from webhdfs import WebHDFS, WebHDFSError, HOST, PORT
+from webhdfs import WebHDFS, WebHDFSError, HOST, PORT, __version__
 from requests import ConnectionError
 
 from argparse import ArgumentParser
     parser.add_argument('--port', help='webhdfs port', type=int,
                         default=None)
     parser.add_argument('--user', help='webhdfs user', default=None)
+    parser.add_argument('--version', action='version',
+                        version='webhdfs {}'.format(__version__))
 
     subs = parser.add_subparsers()