This repository has been archived by the owner on Oct 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
156 lines (130 loc) · 5.5 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
from setuptools import setup, Command
import site
import os
import platform
class Reusing(Command):
description = "Download modules from https://github.com/turulomio/reusingcode/"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from sys import path
path.append("officegenerator")
from github import download_from_github
download_from_github('turulomio','reusingcode','python/github.py', 'officegenerator')
download_from_github('turulomio','reusingcode','python/casts.py', 'officegenerator')
download_from_github('turulomio','reusingcode','python/datetime_functions.py', 'officegenerator')
download_from_github('turulomio','reusingcode','python/decorators.py', 'officegenerator')
download_from_github('turulomio','reusingcode','python/libmanagers.py', 'officegenerator')
download_from_github('turulomio','reusingcode','python/objects/percentage.py', 'officegenerator/objects/')
download_from_github('turulomio','reusingcode','python/objects/currency.py', 'officegenerator/objects/')
## Class to define doc command
class Doc(Command):
description = "Update translations"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
#es
os.system("xgettext -L Python --no-wrap --no-location --from-code='UTF-8' -o locale/officegenerator.pot *.py officegenerator/*.py")
os.system("msgmerge -N --no-wrap -U locale/es.po locale/officegenerator.pot")
os.system("msgfmt -cv -o officegenerator/locale/es/LC_MESSAGES/officegenerator.mo locale/es.po")
class Procedure(Command):
description = "Show release procedure"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print("""Nueva versión:
* Cambiar la versión y la fecha en commons.py
* Modificar el Changelog en README
* python setup.py doc
* linguist
* python setup.py doc
* python setup.py install
* python setup.py doxygen
* git commit -a -m 'officegenerator-{}'
* git push
* Hacer un nuevo tag en GitHub
* python setup.py sdist upload -r pypi
* python setup.py uninstall
* Crea un nuevo ebuild de Gentoo con la nueva versión
* Subelo al repositorio del portage
""".format(__version__))
## Class to define doxygen command
class Doxygen(Command):
description = "Create/update doxygen documentation in doc/html"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
print("Creating Doxygen Documentation")
os.system("""sed -i -e "41d" doc/Doxyfile""")#Delete line 41
os.system("""sed -i -e "41iPROJECT_NUMBER = {}" doc/Doxyfile""".format(__version__))#Insert line 41
os.system("rm -Rf build")
os.chdir("doc")
os.system("doxygen Doxyfile")
os.system("rsync -avzP -e 'ssh -l turulomio' html/ frs.sourceforge.net:/home/users/t/tu/turulomio/userweb/htdocs/doxygen/officegenerator/ --delete-after")
os.chdir("..")
## Class to define uninstall command
class Uninstall(Command):
description = "Uninstall installed files with install"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
if platform.system()=="Linux":
os.system("rm -Rf {}/officegenerator*".format(site.getsitepackages()[0]))
os.system("rm /usr/bin/officegenerator*")
else:
os.system("pip uninstall officegenerator")
########################################################################
## Version of officegenerator captured from commons to avoid problems with package dependencies
__version__= None
with open('officegenerator/commons.py', encoding='utf-8') as f:
for line in f.readlines():
if line.find("__version__ =")!=-1:
__version__=line.split("'")[1]
setup(name='officegenerator',
version=__version__,
description='Python module to read and write LibreOffice and MS Office files',
long_description='Project web page is in https://github.com/turulomio/officegenerator',
long_description_content_type='text/markdown',
classifiers=['Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3',
],
keywords='office generator',
url='https://officegenerator.sourceforge.io/',
author='Turulomio',
author_email='[email protected]',
license='GPL-3',
packages=['officegenerator'],
install_requires=['odfpy==1.3.6','openpyxl'],
entry_points = {'console_scripts': ['officegenerator_demo=officegenerator.demo:main',
'officegenerator_odf2xml=officegenerator.odf2xml:main',
'officegenerator_xlsx2xml=officegenerator.xlsx2xml:main',
],
},
cmdclass={'doxygen': Doxygen,
'uninstall':Uninstall,
'doc': Doc,
'procedure': Procedure,
'reusing': Reusing,
},
zip_safe=False,
test_suite = 'officegenerator.tests',
include_package_data=True
)