setup.py

Wed, 08 Apr 2020 18:27:44 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 08 Apr 2020 18:27:44 +0200
changeset 7510
ef5dd4fc2144
parent 7450
c33c1dbd0ee5
child 7516
d0de88fdba2d
permissions
-rw-r--r--

Added some more dark lexer styles.

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
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7257
diff changeset
4 # Copyright (c) 2019 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
6949
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
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
12 import os
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
13 import sys
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
14 import subprocess
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
15 import shutil
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
16 import fnmatch
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
17 import datetime
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
18
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 from setuptools import setup, find_packages
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
21 ######################################################################
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
22 ## some helper functions below
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
23 ######################################################################
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
24
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
25
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
26 def getVersion():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
27 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
28 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
29
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
30 @return string containing the version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
31 @rtype str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
32 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
33 version = "<unknown>"
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
34 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
35 # 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
36 version = sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
37 del sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
38 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
39 # 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
40 today = datetime.date.today()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
41 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
42 return version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
43
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 def getPackageData(package, extensions):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
46 """
7450
c33c1dbd0ee5 setup.py: fixed a typo
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7381
diff changeset
47 Function to return data files of a package with given extensions.
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
48
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
49 @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
50 @type str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
51 @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
52 @type list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
53 @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
54 @rtype list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
55 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
56 filesList = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
57 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
58 for fname in filenames:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
59 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
60 not fname.startswith('.') and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
61 os.path.splitext(fname)[1] in extensions
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
62 ):
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
63 filesList.append(
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
64 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
65 return filesList
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
66
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
67
7381
cee375d46f2f Added a TODO marker for adding some more .desktop files some time later.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
68 # TODO: add .desktop files for the eric6 tools
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
69 def getDataFiles():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
70 """
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
71 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
72
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
73 @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
74 @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
75 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
76 if sys.platform.startswith('linux'):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
77 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
78 ('share/applications', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
79 'linux/eric6.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
80 'linux/eric6_browser.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
81 ]),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
82 ('share/icons', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
83 'eric6/icons/default/eric.png',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
84 'eric6/icons/default/ericWeb48.png'
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
85 ]),
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
86 ('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
87 ('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
88 ]
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
89 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
90 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
91 ('scripts', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
92 'eric6/pixmaps/eric6.ico',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
93 'eric6/pixmaps/ericWeb48.ico'])
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
94 ]
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
95 else:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
96 dataFiles = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
97 return dataFiles
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
98
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
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 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
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 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
103
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 @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
105 @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
106 """
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 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
108 "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
109 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
110
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 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
112 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
113 "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
114 " 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
115 " 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
116 " 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
117 )
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
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
119 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
120
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
121 ######################################################################
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
122 ## 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
123 ######################################################################
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
124
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
125
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
126 def prepareInfoFile(fileName, version):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
127 """
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
128 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
129
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
130 @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
131 @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
132 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
133 if not fileName:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
134 return
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
135
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
136 try:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
137 os.rename(fileName, fileName + ".orig")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
138 except EnvironmentError:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
139 pass
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
140 try:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
141 hgOut = subprocess.check_output(["hg", "identify", "-i"])
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6958
diff changeset
142 hgOut = hgOut.decode()
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
143 except (OSError, subprocess.CalledProcessError):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
144 hgOut = ""
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
145 if hgOut:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
146 hgOut = hgOut.strip()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
147 if hgOut.endswith("+"):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
148 hgOut = hgOut[:-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
149 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
150 text = f.read()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
151 f.close()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
153 text.replace("@@REVISION@@", hgOut)
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
154 .replace("@@VERSION@@", version)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
155 )
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
156 f = open(fileName, "w")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
157 f.write(text)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
158 f.close()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
159 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
160 shutil.copy(fileName + ".orig", fileName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
161
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
162
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
163 def prepareAppdataFile(fileName, version):
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
164 """
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
165 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
166
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
167 @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
168 @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
169 """
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
170 if not fileName:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
171 return
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
172
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
173 try:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
174 os.rename(fileName, fileName + ".orig")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
175 except EnvironmentError:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
176 pass
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
177 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
178 text = f.read()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
179 f.close()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
180 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
181 text.replace("@VERSION@", version)
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
182 .replace("@DATE@", datetime.date.today().isoformat())
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
183 )
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
184 f = open(fileName, "w")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
185 f.write(text)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
186 f.close()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
187
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
188
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
189 def cleanupSource(dirName):
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 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
192 and directories.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
193
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
194 @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
195 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
196 # 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
197 # *.ui file
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
198 dirListing = os.listdir(dirName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
199 for formName, sourceName in [
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
200 (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
201 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
202 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
203 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
204 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
205 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
206
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
207 # 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
208 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
209 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
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, "*.pyc")]:
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 3: delete *.orig files
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
215 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
216 if fnmatch.fnmatch(f, "*.orig")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
217 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
218
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
219 # 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
220 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
221 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
222 if os.path.isdir(name):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
223 cleanupSource(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
224 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
225 os.rmdir(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
226
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 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
229 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
230 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
231 .ui file.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
232
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
233 @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
234 @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
235 @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
236 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
237 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
238
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
239
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
240 def compileUiFiles(dirName):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
241 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
242 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
243
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
244 @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
245 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
246 from PyQt5.uic import compileUiDir
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
247 compileUiDir(dirName, True, __pyName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
248
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
249 ######################################################################
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
250 ## setup() below
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
251 ######################################################################
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
253 Version = getVersion()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
254 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
255 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
256 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
257 "eric6.appdata.xml")
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
258 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
259 # 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
260 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
261 cleanupSource(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
262 compileUiFiles(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
263 prepareInfoFile(infoFileName, Version)
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
264 prepareAppdataFile(appdataFileName, Version)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
265 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
266
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 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
268 name="eric-ide",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
269 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
270 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
271 " 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
272 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
273 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
274 author="Detlev Offenbach",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 author_email="detlev@die-offenbachs.de",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 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
277 project_urls={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
278 "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
279 "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
280 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
281 platforms=["Linux", "Windows", "macOS"],
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
282 license="GPLv3",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 classifiers=[
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 "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
285 "Environment :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 "Environment :: Win32 (MS Windows)",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 "Environment :: X11 Applications",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 "Environment :: X11 Applications :: Qt",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 "Intended Audience :: Developers",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 "Intended Audience :: End Users/Desktop",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 "Natural Language :: English",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 "Natural Language :: German",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 "Natural Language :: Russian",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 "Natural Language :: Spanish",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 "Operating System :: MacOS :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "Operating System :: Microsoft :: Windows :: Windows 10",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 "Operating System :: POSIX :: Linux",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 "Programming Language :: Python",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 "Programming Language :: Python :: 2.7",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 "Programming Language :: Python :: 3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 "Programming Language :: Python :: 3.6",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 "Programming Language :: Python :: 3.7",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 "Topic :: Software Development",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 "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
305 ],
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 keywords="Development PyQt5 IDE Python3",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 python_requires=">=3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 install_requires=[
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 "PyQt5>=5.12.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 "PyQtWebEngine>=5.12.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 "QScintilla>=2.11.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 "pip",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 "docutils",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 "Markdown",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
315 "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
316 ],
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
317 data_files=getDataFiles(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
318 packages=find_packages(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
319 zip_safe=False,
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
320 package_data={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
321 "": getPackageData(
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
322 "eric6",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
323 [".png", ".svg", ".svgz", ".xpm", ".ico", ".gif", ".icns", ".txt",
7216
4dd9231b349e setup.py: removed the obsolete ".style" entry for package data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6958
diff changeset
324 ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api",
4dd9231b349e setup.py: removed the obsolete ".style" entry for package data.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6958
diff changeset
325 ".bas" ".dat"]
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
326 ) + ["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
327 "i18n/eric6_ru.qm",
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
328 ]
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
329 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
330 entry_points={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
331 "gui_scripts": [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
332 "eric6 = eric6.eric6:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
333 "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
334 "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
335 "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
336 "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
337 "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
338 "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
339 "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
340 "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
341 "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
342 "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
343 "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
344 "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
345 "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
346 "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
347 "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
348 "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
349 "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
350 "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
351 "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
352 "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
353 ],
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
354 "console_scripts": [
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
355 "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
356 "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
357 "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
358 ],
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
359 },
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 )
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
361
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
362 # cleanup
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
363 for fileName in [infoFileName, appdataFileName]:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
364 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
365 try:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
366 os.remove(fileName)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
367 os.rename(fileName + ".orig", fileName)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
368 except EnvironmentError:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
369 pass

eric ide

mercurial