setup.py

Mon, 12 Oct 2020 19:28:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 12 Oct 2020 19:28:42 +0200
changeset 7781
607a6098cb44
parent 7775
4a1db75550bd
child 7785
9978016560ec
permissions
-rw-r--r--

Performed some more code cleanup.

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 import os
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
12 import sys
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7562
diff changeset
13 import subprocess # secok
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
14 import shutil
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
15 import fnmatch
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
16 import datetime
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
17
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from setuptools import setup, find_packages
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
20 ######################################################################
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
21 ## some helper functions below
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
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
24
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
25 def getVersion():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
26 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
27 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
28
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
29 @return string containing the version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
30 @rtype str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
31 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
32 version = "<unknown>"
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
33 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
34 # 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
35 version = sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
36 del sys.argv[-1]
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
37 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
38 # 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
39 today = datetime.date.today()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
40 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
41 return version
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
42
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 def getPackageData(package, extensions):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
45 """
7450
c33c1dbd0ee5 setup.py: fixed a typo
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7381
diff changeset
46 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
47
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
48 @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
49 @type str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
50 @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
51 @type list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
52 @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
53 @rtype list of str
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
54 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
55 filesList = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
56 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
57 for fname in filenames:
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
58 if (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
59 not fname.startswith('.') and
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
60 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
61 ):
6949
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
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
67 # 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
68 def getDataFiles():
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
69 """
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
70 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
71
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
72 @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
73 @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
74 """
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
75 if sys.platform.startswith('linux'):
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
76 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
77 ('share/applications', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
78 'linux/eric6.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
79 'linux/eric6_browser.desktop',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
80 ]),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
81 ('share/icons', [
7516
d0de88fdba2d setup.py: changed the icons setup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7450
diff changeset
82 'eric6/icons/breeze-dark/eric.svg',
d0de88fdba2d setup.py: changed the icons setup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7450
diff changeset
83 'eric6/icons/breeze-dark/ericWeb48.svg'
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
84 ]),
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
85 ('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
86 ('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
87 ]
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
88 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
89 dataFiles = [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
90 ('scripts', [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
91 'eric6/pixmaps/eric6.ico',
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
92 'eric6/pixmaps/ericWeb48.ico'])
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
93 ]
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
94 else:
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
95 dataFiles = []
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
96 return dataFiles
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
97
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
98
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 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
100 """
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 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
102
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 @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
104 @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
105 """
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 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
107 "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
108 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
109
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 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
111 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 "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
113 " 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
114 " 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
115 " 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
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
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 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
119
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
120 ######################################################################
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
121 ## 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
122 ######################################################################
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
123
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
124
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
125 def prepareInfoFile(fileName, version):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
126 """
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
127 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
128
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
129 @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
130 @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
131 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
132 if not fileName:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
133 return
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
134
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
135 try:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
136 os.rename(fileName, fileName + ".orig")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
137 except EnvironmentError:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
138 pass
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
139 try:
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7562
diff changeset
140 hgOut = subprocess.check_output(["hg", "identify", "-i"]) # secok
7192
a22eee00b052 Started removing runtime support for Python2 and PyQt4.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6958
diff changeset
141 hgOut = hgOut.decode()
6950
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()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
151 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 text.replace("@@REVISION@@", hgOut)
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
153 .replace("@@VERSION@@", version)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
154 )
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
155 f = open(fileName, "w")
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
156 f.write(text)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
157 f.close()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
158 else:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
159 shutil.copy(fileName + ".orig", fileName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
160
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
161
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
162 def prepareAppdataFile(fileName, version):
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 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
165
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
166 @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
167 @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
168 """
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
169 if not fileName:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
170 return
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
171
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
172 try:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
173 os.rename(fileName, fileName + ".orig")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
174 except EnvironmentError:
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
175 pass
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
176 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
177 text = f.read()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
178 f.close()
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
179 text = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
180 text.replace("@VERSION@", version)
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
181 .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
182 )
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
183 f = open(fileName, "w")
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
184 f.write(text)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
185 f.close()
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
186
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
187
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
188 def cleanupSource(dirName):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
189 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
190 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
191 and directories.
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
192
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
193 @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
194 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
195 # 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
196 # *.ui file
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
197 dirListing = os.listdir(dirName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
198 for formName, sourceName in [
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
199 (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
200 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
201 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
202 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
203 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
204 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
205
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
206 # 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
207 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
208 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
209 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
210 if fnmatch.fnmatch(f, "*.pyc")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
211 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
212
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
213 # step 3: delete *.orig files
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
214 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
215 if fnmatch.fnmatch(f, "*.orig")]:
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
216 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
217
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
218 # 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
219 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
220 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
221 if os.path.isdir(name):
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
222 cleanupSource(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
223 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
224 os.rmdir(name)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
225
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 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
228 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
229 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
230 .ui file.
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 @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
233 @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
234 @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
235 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
236 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
237
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 def compileUiFiles(dirName):
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 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
242
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
243 @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
244 """
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
245 from PyQt5.uic import compileUiDir
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
246 compileUiDir(dirName, True, __pyName)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
247
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
248 ######################################################################
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
249 ## setup() below
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
250 ######################################################################
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
252 Version = getVersion()
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
253 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
254 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
255 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
256 "eric6.appdata.xml")
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
257 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
258 # 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
259 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
260 cleanupSource(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
261 compileUiFiles(sourceDir)
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
262 prepareInfoFile(infoFileName, Version)
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
263 prepareAppdataFile(appdataFileName, Version)
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
264 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
265
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 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
267 name="eric-ide",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
268 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
269 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
270 " 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
271 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
272 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
273 author="Detlev Offenbach",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 author_email="detlev@die-offenbachs.de",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 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
276 project_urls={
7562
0f25563f8ff4 setup.py: corrected the links to the source code repository and the issues tracker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7539
diff changeset
277 "Source Code": "https://hg.die-offenbachs.homelinux.org/eric/",
0f25563f8ff4 setup.py: corrected the links to the source code repository and the issues tracker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7539
diff changeset
278 "Issues Tracker": "https://tracker.die-offenbachs.homelinux.org/",
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
279 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
280 platforms=["Linux", "Windows", "macOS"],
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
281 license="GPLv3",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 classifiers=[
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 "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
284 "Environment :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 "Environment :: Win32 (MS Windows)",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 "Environment :: X11 Applications",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 "Environment :: X11 Applications :: Qt",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 "Intended Audience :: Developers",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 "Intended Audience :: End Users/Desktop",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 "Natural Language :: English",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 "Natural Language :: German",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 "Natural Language :: Russian",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 "Natural Language :: Spanish",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 "Operating System :: MacOS :: MacOS X",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 "Operating System :: Microsoft :: Windows :: Windows 10",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 "Operating System :: POSIX :: Linux",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 "Programming Language :: Python",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 "Programming Language :: Python :: 3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 "Programming Language :: Python :: 3.6",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 "Programming Language :: Python :: 3.7",
7657
428836188b88 setup.py corrected the setup.py file to remove Python 2.7 and add Python 3.8 as supported versions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7640
diff changeset
301 "Programming Language :: Python :: 3.8",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 "Topic :: Software Development",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 "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
304 ],
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 keywords="Development PyQt5 IDE Python3",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 python_requires=">=3.5",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 install_requires=[
7640
f9bb7c8c60d8 setup.py: changed the order of packages in 'install_requires'. Hopefully this install pip and wheel before PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
308 "pip>=19.0",
f9bb7c8c60d8 setup.py: changed the order of packages in 'install_requires'. Hopefully this install pip and wheel before PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
309 "wheel",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 "PyQt5>=5.12.1",
7539
d6d4d83dad4c setup.py: updated the dependecies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7516
diff changeset
311 "PyQtChart>=5.12.1",
6946
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 "PyQtWebEngine>=5.12.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 "QScintilla>=2.11.1",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 "docutils",
660757d6c57b setup.py: started implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 "Markdown",
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
316 "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
317 ],
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
318 data_files=getDataFiles(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
319 packages=find_packages(),
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
320 zip_safe=False,
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
321 package_data={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
322 "": getPackageData(
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
323 "eric6",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
324 [".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
325 ".tmpl", ".html", ".qch", ".css", ".qss", ".e4h", ".e6h", ".api",
7715
ae49e290890d setup.py: extended data file extensions to include all data files the source depends on (prepare to get rid of resources).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7657
diff changeset
326 ".bas", ".dat", ".xbel", ".xml", ".js"]
6950
62e39a353cd9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6949
diff changeset
327 ) + ["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
328 "i18n/eric6_ru.qm",
6951
ef3e87580dc9 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6950
diff changeset
329 ]
6949
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
330 },
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
331 entry_points={
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
332 "gui_scripts": [
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
333 "eric6 = eric6.eric6:main",
a5255f1ba3f0 setup.py: continued implementing support for setup.py.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6946
diff changeset
334 "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
335 "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
336 "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
337 "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
338 "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
339 "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
340 "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
341 "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
342 "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
343 "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
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