setup.py

Wed, 29 May 2019 22:14:02 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 29 May 2019 22:14:02 +0200
branch
Variables Viewer
changeset 7030
73779c4c135a
parent 6958
949c3c76cc8a
child 7192
a22eee00b052
child 7216
4dd9231b349e
permissions
-rw-r--r--

Bugfix displaying to many characters as default_factory type.

6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 #!/usr/bin/env python3
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
4 # Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de>
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
5 #
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
6
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
7 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
8 Module to prepare a distribution package for uploading to PyPI.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
9 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
10
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
11 from __future__ import unicode_literals
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
12
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
13 import os
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
14 import sys
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
15 import subprocess
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
16 import shutil
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
17 import fnmatch
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
18 import datetime
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
19
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from setuptools import setup, find_packages
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
22 ######################################################################
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
23 ## some helper functions below
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
24 ######################################################################
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
25
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
26
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
27 def getVersion():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
28 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
29 Function to get the version from file.
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
30
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
31 @return string containing the version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
32 @rtype str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
33 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
34 version = "<unknown>"
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
35 if sys.argv[-1].startswith(("1", "2")):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
36 # assume it is a version info starting with year
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
37 version = sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
38 del sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
39 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
40 # calculate according our version scheme (year.month)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
41 today = datetime.date.today()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
42 version = "{0}.{1}".format(today.year - 2000, today.month)
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
43 return version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
44
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
45
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
46 def getPackageData(package, extensions):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
47 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
48 Function to return data files of a package with givene extensions.
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
49
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
50 @param package name of the package directory
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
51 @type str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
52 @param extensions list of extensions to test for
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
53 @type list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
54 @return list of package data files
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
55 @rtype list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
56 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
57 filesList = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
58 for dirpath, _dirnames, filenames in os.walk(package):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
59 for fname in filenames:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
60 if not fname.startswith('.') and \
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
61 os.path.splitext(fname)[1] in extensions:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
62 filesList.append(
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
63 os.path.relpath(os.path.join(dirpath, fname), package))
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
64 return filesList
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
65
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
66
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
67 def getDataFiles():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
68 """
6958
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
69 Function to return data_files in a platform dependent manner.
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
70
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
71 @return list containing the platform specific data files
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
72 @rtype list of tuples of (str, list of str)
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
73 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
74 if sys.platform.startswith('linux'):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
75 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
76 ('share/applications', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
77 'linux/eric6.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
78 'linux/eric6_browser.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
79 ]),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
80 ('share/icons', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
81 'eric6/icons/default/eric.png',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
82 'eric6/icons/default/ericWeb48.png'
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
83 ]),
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
84 ('share/appdata', ['linux/eric6.appdata.xml']),
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
85 ('share/metainfo', ['linux/eric6.appdata.xml']),
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
86 ]
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
87 elif sys.platform.startswith(("win", "cygwin")):
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
88 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
89 ('scripts', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
90 'eric6/pixmaps/eric6.ico',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
91 'eric6/pixmaps/ericWeb48.ico'])
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
92 ]
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
93 else:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
94 dataFiles = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
95 return dataFiles
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
96
6958
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
97
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
98 def getLongDescription():
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
99 """
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
100 Function to get the long description via the README file.
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
101
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
102 @return long description
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
103 @rtype str
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
104 """
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
105 with open(os.path.join(os.path.dirname(__file__), "docs", "README.rst"),
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
106 "r") as f:
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
107 longDescription = f.read()
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
108
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
109 if not longDescription:
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
110 longDescription = (
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
111 "eric6 is an integrated development environment for the Python"
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
112 " programming language. It uses the PyQt5 bindings and the"
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
113 " QScintilla2 editor widget. See"
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
114 " https://eric-ide.python-projects.org for more details."
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
115 )
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
116
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
117 return longDescription
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
118
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
119 ######################################################################
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
120 ## functions to prepare the sources for building
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
121 ######################################################################
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
122
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
123
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
124 def prepareInfoFile(fileName, version):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
125 """
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
126 Function to prepare an Info.py file.
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
127
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
128 @param fileName name of the Python file containing the info (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
129 @param version version string for the package (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
130 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
131 if not fileName:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
132 return
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
133
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
134 try:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
135 os.rename(fileName, fileName + ".orig")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
136 except EnvironmentError:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
137 pass
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
138 try:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
139 hgOut = subprocess.check_output(["hg", "identify", "-i"])
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
140 if sys.version_info[0] == 3:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
141 hgOut = hgOut.decode()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
142 except (OSError, subprocess.CalledProcessError):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
143 hgOut = ""
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
144 if hgOut:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
145 hgOut = hgOut.strip()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
146 if hgOut.endswith("+"):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
147 hgOut = hgOut[:-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
148 f = open(fileName + ".orig", "r", encoding="utf-8")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
149 text = f.read()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
150 f.close()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
151 text = text.replace("@@REVISION@@", hgOut)\
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
152 .replace("@@VERSION@@", version)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
153 f = open(fileName, "w")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
154 f.write(text)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
155 f.close()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
156 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
157 shutil.copy(fileName + ".orig", fileName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
158
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
159
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
160 def prepareAppdataFile(fileName, version):
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
161 """
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
162 Function to prepare a .appdata.xml file.
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
163
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
164 @param fileName name of the .appdata.xml file (string)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
165 @param version version string for the package (string)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
166 """
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
167 if not fileName:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
168 return
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
169
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
170 try:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
171 os.rename(fileName, fileName + ".orig")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
172 except EnvironmentError:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
173 pass
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
174 f = open(fileName + ".orig", "r", encoding="utf-8")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
175 text = f.read()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
176 f.close()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
177 text = text.replace("@VERSION@", version)\
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
178 .replace("@DATE@", datetime.date.today().isoformat())
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
179 f = open(fileName, "w")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
180 f.write(text)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
181 f.close()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
182
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
183
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
184 def cleanupSource(dirName):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
185 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
186 Cleanup the sources directory to get rid of leftover files
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
187 and directories.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
188
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
189 @param dirName name of the directory to prune (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
190 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
191 # step 1: delete all Ui_*.py files without a corresponding
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
192 # *.ui file
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
193 dirListing = os.listdir(dirName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
194 for formName, sourceName in [
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
195 (f.replace('Ui_', "").replace(".py", ".ui"), f)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
196 for f in dirListing if fnmatch.fnmatch(f, "Ui_*.py")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
197 if not os.path.exists(os.path.join(dirName, formName)):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
198 os.remove(os.path.join(dirName, sourceName))
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
199 if os.path.exists(os.path.join(dirName, sourceName + "c")):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
200 os.remove(os.path.join(dirName, sourceName + "c"))
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
201
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
202 # step 2: delete the __pycache__ directory and all remaining *.pyc files
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
203 if os.path.exists(os.path.join(dirName, "__pycache__")):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
204 shutil.rmtree(os.path.join(dirName, "__pycache__"))
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
205 for name in [f for f in os.listdir(dirName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
206 if fnmatch.fnmatch(f, "*.pyc")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
207 os.remove(os.path.join(dirName, name))
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
208
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
209 # step 3: delete *.orig files
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
210 for name in [f for f in os.listdir(dirName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
211 if fnmatch.fnmatch(f, "*.orig")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
212 os.remove(os.path.join(dirName, name))
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
213
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
214 # step 4: descent into subdirectories and delete them if empty
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
215 for name in os.listdir(dirName):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
216 name = os.path.join(dirName, name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
217 if os.path.isdir(name):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
218 cleanupSource(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
219 if len(os.listdir(name)) == 0:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
220 os.rmdir(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
221
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
222
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
223 def __pyName(py_dir, py_file):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
224 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
225 Local function to create the Python source file name for the compiled
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
226 .ui file.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
227
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
228 @param py_dir suggested name of the directory (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
229 @param py_file suggested name for the compile source file (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
230 @return tuple of directory name (string) and source file name (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
231 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
232 return py_dir, "Ui_{0}".format(py_file)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
233
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
234
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
235 def compileUiFiles(dirName):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
236 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
237 Compile the .ui files to Python sources.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
238
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
239 @param dirName name of the directory to compile UI files for (string)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
240 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
241 from PyQt5.uic import compileUiDir
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
242 compileUiDir(dirName, True, __pyName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
243
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
244 ######################################################################
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
245 ## setup() below
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
246 ######################################################################
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
248 Version = getVersion()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
249 sourceDir = os.path.join(os.path.dirname(__file__), "eric6")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
250 infoFileName = os.path.join(sourceDir, "UI", "Info.py")
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
251 appdataFileName = os.path.join(os.path.dirname(__file__), "linux",
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
252 "eric6.appdata.xml")
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
253 if sys.argv[1].startswith("bdist"):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
254 # prepare the sources under "eric6" for building the wheel file
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
255 print("preparing the sources...") # __IGNORE_WARNING_M801__
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
256 cleanupSource(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
257 compileUiFiles(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
258 prepareInfoFile(infoFileName, Version)
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
259 prepareAppdataFile(appdataFileName, Version)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
260 print("Preparation finished") # __IGNORE_WARNING_M801__
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
261
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 setup(
6958
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
263 name="eric-ide",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
264 version=Version,
6958
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
265 description="eric-ide is an integrated development environment for the"
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
266 " Python language.",
6958
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
267 long_description=getLongDescription(),
949c3c76cc8a setup.py: continued implementing support for setup.py and tested against test.pypi.org.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6951
diff changeset
268 long_description_content_type="text/x-rst",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 author="Detlev Offenbach",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 author_email="detlev@die-offenbachs.de",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 url="https://eric-ide.python-projects.org",
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
272 project_urls={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
273 "Source Code": "https://die-offenbachs.homelinux.org/hg/eric/",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
274 "Issues Tracker": "https://die-offenbachs.homelinux.org/issues/",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
275 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
276 platforms=["Linux", "Windows", "macOS"],
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
277 license="GPLv3",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 classifiers=[
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 "Environment :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 "Environment :: Win32 (MS Windows)",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 "Environment :: X11 Applications",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 "Environment :: X11 Applications :: Qt",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 "Intended Audience :: Developers",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 "Intended Audience :: End Users/Desktop",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 "Natural Language :: English",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 "Natural Language :: German",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 "Natural Language :: Russian",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 "Natural Language :: Spanish",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 "Operating System :: MacOS :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 "Operating System :: Microsoft :: Windows :: Windows 10",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 "Operating System :: POSIX :: Linux",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 "Programming Language :: Python",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 "Programming Language :: Python :: 2.7",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 "Programming Language :: Python :: 3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "Programming Language :: Python :: 3.6",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 "Programming Language :: Python :: 3.7",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 "Topic :: Software Development",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 "Topic :: Text Editors :: Integrated Development Environments (IDE)"
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 ],
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 keywords="Development PyQt5 IDE Python3",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 python_requires=">=3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 install_requires=[
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 "PyQt5>=5.12.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 "PyQtWebEngine>=5.12.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 "QScintilla>=2.11.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 "pip",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 "docutils",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 "Markdown",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
310 "pywin32>=1.0;platform_system=='Windows'",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 ],
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
312 data_files=getDataFiles(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
313 packages=find_packages(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
314 zip_safe=False,
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
315 package_data={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
316 "": getPackageData(
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
317 "eric6",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
318 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
319 ".style", ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
320 ".e6h", ".api", ".bas" ".dat"]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
321 ) + ["i18n/eric6_de.qm", "i18n/eric6_en.qm", "i18n/eric6_es.qm",
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
322 "i18n/eric6_ru.qm",
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
323 ]
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
324 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
325 entry_points={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
326 "gui_scripts": [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
327 "eric6 = eric6.eric6:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
328 "eric6_browser = eric6.eric6_browser:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
329 "eric6_compare = eric6.eric6_compare:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
330 "eric6_configure = eric6.eric6_configure:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
331 "eric6_diff = eric6.eric6_diff:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
332 "eric6_editor = eric6.eric6_editor:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
333 "eric6_hexeditor = eric6.eric6_hexeditor:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
334 "eric6_iconeditor = eric6.eric6_iconeditor:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
335 "eric6_plugininstall = eric6.eric6_plugininstall:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
336 "eric6_pluginrepository = eric6.eric6_pluginrepository:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
337 "eric6_pluginuninstall = eric6.eric6_pluginuninstall:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
338 "eric6_qregexp = eric6.eric6_qregexp:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
339 "eric6_qregularexpression = eric6.eric6_qregularexpression:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
340 "eric6_re = eric6.eric6_re:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
341 "eric6_shell = eric6.eric6_shell:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
342 "eric6_snap = eric6.eric6_snap:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
343 "eric6_sqlbrowser = eric6.eric6_sqlbrowser:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
344 "eric6_tray = eric6.eric6_tray:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
345 "eric6_trpreviewer = eric6.eric6_trpreviewer:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
346 "eric6_uipreviewer = eric6.eric6_uipreviewer:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
347 "eric6_unittest = eric6.eric6_unittest:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
348 ],
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
349 "console_scripts": [
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
350 "eric6_api = eric6.eric6_api:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
351 "eric6_doc = eric6.eric6_doc:main",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
352 "eric6_post_install = eric6.eric6_post_install:main"
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
353 ],
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
354 },
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 )
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
356
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
357 # cleanup
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
358 for fileName in [infoFileName, appdataFileName]:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
359 if os.path.exists(fileName + ".orig"):
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
360 try:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
361 os.remove(fileName)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
362 os.rename(fileName + ".orig", fileName)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
363 except EnvironmentError:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
364 pass

eric ide

mercurial