forked from vitalyrodnenko/geeknote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
140 lines (116 loc) · 3.54 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import sys
import os
import getpass
import codecs
import geeknote
from setuptools import setup
from setuptools.command.install import install
BASH_COMPLETION = '''
_geeknote_command()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
SAVE_IFS=$IFS
IFS=" "
args="${COMP_WORDS[*]:1}"
IFS=$SAVE_IFS
COMPREPLY=( $(compgen -W "`geeknote autocomplete ${args}`" -- ${cur}) )
return 0
}
complete -F _geeknote_command geeknote
'''
def read(fname):
return codecs.open(os.path.join(os.path.dirname(__file__), fname)).read()
class full_install(install):
user_options = install.user_options + [
('userhome', None, "(Linux only) Set user home directory for"
" bash completion (/home/{0})"
.format(getpass.getuser()))
]
def initialize_options(self):
install.initialize_options(self)
self.userhome = ''
def run(self):
if sys.platform == 'linux2':
self.install_autocomplite()
install.run(self)
def install_autocomplite(self):
if self.userhome:
self.userhome = '{0}/.bash_completion'.format(self.userhome)
else:
self.userhome = '/home/{0}/.bash_completion'.format(os.getlogin())
if not BASH_COMPLETION in open(self.userhome, 'r').read():
with open(self.userhome, 'a') as completion:
print('Autocomplete was written to {0}'.format(self.userhome))
completion.write(BASH_COMPLETION)
setup(
name='geeknote',
version=geeknote.__version__,
license='GPL',
author='Vitaliy Rodnenko',
author_email='vitaliy@rodnenko.ru',
description='Geeknote - is a command line client for Evernote, '
'that can be use on Linux, FreeBSD and OS X.',
long_description=read("README.md"),
url='http://www.geeknote.me',
packages=['geeknote'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Environment :: Console',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Utilities',
],
install_requires=[
'evernote>=1.17',
'html2text',
'sqlalchemy',
'markdown2',
'beautifulsoup4',
'thrift'
],
entry_points={
'console_scripts': [
'geeknote = geeknote.geeknote:main',
'gnsync = geeknote.gnsync:main'
]
},
# cmdclass={
# 'install': full_install
# },
platforms='Any',
test_suite='tests',
zip_safe=False,
keywords='Evernote, console'
)
"""
import time
import os
from setuptools import setup, find_packages
# local
import config
os.system('rm -rf geeknote')
packages = ['geeknote.' + x for x in find_packages()] + ['geeknote']
# This is to properly encapsulate the library during egg generation
os.system('mkdir .geeknote && cp -pr * .geeknote/ && mv .geeknote geeknote')
setup(
name = "geeknote",
version = time.strftime(str(config.VERSION) + '.%Y%m%d.%H%M'),
packages = packages,
author = 'Vitaliy Rodnenko',
author_email = 'vitaly@webpp.ru',
description = 'terminal-mode geeknote client and synchronizer',
entry_points = {
'console_scripts': [
'geeknote = geeknote.geeknote:main',
'gnsync = geeknote.gnsync:main',
]
}
)
"""