Added the capability to define the project license in the project properties dialog. eric7

Sun, 05 Jun 2022 16:52:05 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 05 Jun 2022 16:52:05 +0200
branch
eric7
changeset 9125
3d2411181b3c
parent 9124
a27836f4ad69
child 9126
36fc79de5778

Added the capability to define the project license in the project properties dialog.

eric7.epj file | annotate | diff | comparison | revisions
eric7/Project/Project.py file | annotate | diff | comparison | revisions
eric7/Project/PropertiesDialog.py file | annotate | diff | comparison | revisions
eric7/Project/PropertiesDialog.ui file | annotate | diff | comparison | revisions
eric7/data/trove_license_classifiers.txt file | annotate | diff | comparison | revisions
setup.py file | annotate | diff | comparison | revisions
--- a/eric7.epj	Sat Jun 04 17:07:11 2022 +0200
+++ b/eric7.epj	Sun Jun 05 16:52:05 2022 +0200
@@ -737,6 +737,7 @@
     },
     "INTERFACES": [],
     "LEXERASSOCS": {},
+    "LICENSE": "GNU General Public License v3 or later (GPLv3+)",
     "MAINSCRIPT": "eric7/eric7.py",
     "MAKEPARAMS": {
       "MakeEnabled": false,
@@ -939,6 +940,7 @@
       "eric7/WebBrowser/data/javascript/jquery-ui.js",
       "eric7/WebBrowser/data/javascript/jquery.js",
       "eric7/WebBrowser/data/javascript/qwebchannel.js",
+      "eric7/data/trove_license_classifiers.txt",
       "eric7/icons",
       "eric7/pixmaps",
       "linux/eric7.appdata.xml",
@@ -2348,6 +2350,7 @@
     "SPELLEXCLUDES": "Dictionaries/excludes.dic",
     "SPELLLANGUAGE": "en_US",
     "SPELLWORDS": "Dictionaries/words.dic",
+    "TESTING_FRAMEWORK": "",
     "TRANSLATIONEXCEPTIONS": [],
     "TRANSLATIONPATTERN": "eric7/i18n/eric7_%language%.ts",
     "TRANSLATIONS": [
--- a/eric7/Project/Project.py	Sat Jun 04 17:07:11 2022 +0200
+++ b/eric7/Project/Project.py	Sun Jun 05 16:52:05 2022 +0200
@@ -526,6 +526,7 @@
             "EOL": -1,
             "DOCSTRING": "",
             "TESTING_FRAMEWORK": "",
+            "LICENSE": "",
         }
         
         self.__initDebugProperties()
--- a/eric7/Project/PropertiesDialog.py	Sat Jun 04 17:07:11 2022 +0200
+++ b/eric7/Project/PropertiesDialog.py	Sun Jun 05 16:52:05 2022 +0200
@@ -13,6 +13,7 @@
 from PyQt6.QtCore import QDir, pyqtSlot
 from PyQt6.QtWidgets import QDialog, QDialogButtonBox
 
+from EricWidgets import EricMessageBox
 from EricWidgets.EricApplication import ericApp
 from EricWidgets.EricPathPicker import EricPathPickerModes
 
@@ -89,6 +90,8 @@
             Utilities.fromNativeSeparators(ipath) + "/",
         ]
         
+        self.__populateLicenseComboBox()
+        
         if not new:
             name = os.path.splitext(self.project.pfile)[0]
             self.nameEdit.setText(os.path.basename(name))
@@ -140,9 +143,11 @@
                 cindex = self.testingFrameworkComboBox.findData(
                     self.project.pdata["TESTING_FRAMEWORK"])
                 self.testingFrameworkComboBox.setCurrentIndex(cindex)
+            with contextlib.suppress(KeyError):
+                self.licenseComboBox.setCurrentText(
+                    self.project.pdata["LICENSE"])
         else:
-            self.languageComboBox.setCurrentIndex(
-                self.languageComboBox.findText("Python3"))
+            self.languageComboBox.setCurrentText("Python3")
             self.projectTypeComboBox.setCurrentIndex(
                 self.projectTypeComboBox.findData("PyQt6"))
             self.dirPicker.setText(self.__initPaths[0])
@@ -156,6 +161,36 @@
             bool(self.dirPicker.text()) and
             self.dirPicker.text() not in self.__initPaths)
     
+    def __populateLicenseComboBox(self):
+        """
+        Private method to populate the license selector with the list of trove
+        license types.
+        
+        Note: The trove licanese list file was created from querying
+        "https://pypi.org/pypi?%3Aaction=list_classifiers".
+        """
+        filename = os.path.join(
+            os.path.dirname(__file__), "..", "data",
+            "trove_license_classifiers.txt")
+        try:
+            with open(filename, "r") as f:
+                lines = f.readlines()
+        except OSError as err:
+            EricMessageBox.warning(
+                self,
+                self.tr("Reading Trove License Classifiers"),
+                self.tr("""<p>The Trove Classifiers file <b>{0}</b>"""
+                        """ could not be read.</p><p>Reason: {1}</p>""")
+                .format(filename, str(err)))
+            return
+        
+        self.licenseComboBox.addItem("")
+        self.licenseComboBox.addItems(
+            line.split("::")[-1].strip()
+            for line in lines
+            if line.startswith("License ")      # play it safe
+        )
+    
     @pyqtSlot(str)
     def on_languageComboBox_currentTextChanged(self, language):
         """
@@ -353,3 +388,5 @@
         self.project.pdata["TESTING_FRAMEWORK"] = (
             self.testingFrameworkComboBox.currentData()
         )
+        
+        self.project.pdata["LICENSE"] = self.licenseComboBox.currentText()
--- a/eric7/Project/PropertiesDialog.ui	Sat Jun 04 17:07:11 2022 +0200
+++ b/eric7/Project/PropertiesDialog.ui	Sun Jun 05 16:52:05 2022 +0200
@@ -318,6 +318,29 @@
        </property>
       </widget>
      </item>
+     <item row="13" column="0">
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>License:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="13" column="1">
+      <widget class="QComboBox" name="licenseComboBox">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip">
+        <string>Enter or select the project license</string>
+       </property>
+       <property name="editable">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item>
@@ -490,6 +513,7 @@
   <tabstop>emailEdit</tabstop>
   <tabstop>descriptionEdit</tabstop>
   <tabstop>testingFrameworkComboBox</tabstop>
+  <tabstop>licenseComboBox</tabstop>
   <tabstop>spellPropertiesButton</tabstop>
   <tabstop>transPropertiesButton</tabstop>
   <tabstop>makeCheckBox</tabstop>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric7/data/trove_license_classifiers.txt	Sun Jun 05 16:52:05 2022 +0200
@@ -0,0 +1,83 @@
+License :: Aladdin Free Public License (AFPL)
+License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
+License :: CeCILL-B Free Software License Agreement (CECILL-B)
+License :: CeCILL-C Free Software License Agreement (CECILL-C)
+License :: DFSG approved
+License :: Eiffel Forum License (EFL)
+License :: Free For Educational Use
+License :: Free For Home Use
+License :: Free To Use But Restricted
+License :: Free for non-commercial use
+License :: Freely Distributable
+License :: Freeware
+License :: GUST Font License 1.0
+License :: GUST Font License 2006-09-30
+License :: Netscape Public License (NPL)
+License :: Nokia Open Source License (NOKOS)
+License :: OSI Approved
+License :: OSI Approved :: Academic Free License (AFL)
+License :: OSI Approved :: Apache Software License
+License :: OSI Approved :: Apple Public Source License
+License :: OSI Approved :: Artistic License
+License :: OSI Approved :: Attribution Assurance License
+License :: OSI Approved :: BSD License
+License :: OSI Approved :: Boost Software License 1.0 (BSL-1.0)
+License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
+License :: OSI Approved :: Common Development and Distribution License 1.0 (CDDL-1.0)
+License :: OSI Approved :: Common Public License
+License :: OSI Approved :: Eclipse Public License 1.0 (EPL-1.0)
+License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
+License :: OSI Approved :: Eiffel Forum License
+License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)
+License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)
+License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
+License :: OSI Approved :: GNU Affero General Public License v3
+License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
+License :: OSI Approved :: GNU Free Documentation License (FDL)
+License :: OSI Approved :: GNU General Public License (GPL)
+License :: OSI Approved :: GNU General Public License v2 (GPLv2)
+License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
+License :: OSI Approved :: GNU General Public License v3 (GPLv3)
+License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
+License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)
+License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)
+License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
+License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
+License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
+License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)
+License :: OSI Approved :: IBM Public License
+License :: OSI Approved :: ISC License (ISCL)
+License :: OSI Approved :: Intel Open Source License
+License :: OSI Approved :: Jabber Open Source License
+License :: OSI Approved :: MIT License
+License :: OSI Approved :: MIT No Attribution License (MIT-0)
+License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW)
+License :: OSI Approved :: MirOS License (MirOS)
+License :: OSI Approved :: Motosoto License
+License :: OSI Approved :: Mozilla Public License 1.0 (MPL)
+License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)
+License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
+License :: OSI Approved :: Nethack General Public License
+License :: OSI Approved :: Nokia Open Source License
+License :: OSI Approved :: Open Group Test Suite License
+License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)
+License :: OSI Approved :: PostgreSQL License
+License :: OSI Approved :: Python License (CNRI Python License)
+License :: OSI Approved :: Python Software Foundation License
+License :: OSI Approved :: Qt Public License (QPL)
+License :: OSI Approved :: Ricoh Source Code Public License
+License :: OSI Approved :: SIL Open Font License 1.1 (OFL-1.1)
+License :: OSI Approved :: Sleepycat License
+License :: OSI Approved :: Sun Industry Standards Source License (SISSL)
+License :: OSI Approved :: Sun Public License
+License :: OSI Approved :: The Unlicense (Unlicense)
+License :: OSI Approved :: Universal Permissive License (UPL)
+License :: OSI Approved :: University of Illinois/NCSA Open Source License
+License :: OSI Approved :: Vovida Software License 1.0
+License :: OSI Approved :: W3C License
+License :: OSI Approved :: X.Net License
+License :: OSI Approved :: Zope Public License
+License :: OSI Approved :: zlib/libpng License
+License :: Other/Proprietary License
+License :: Public Domain
+License :: Repoze Public License
--- a/setup.py	Sat Jun 04 17:07:11 2022 +0200
+++ b/setup.py	Sun Jun 05 16:52:05 2022 +0200
@@ -310,9 +310,10 @@
         "Issues Tracker": "https://tracker.die-offenbachs.homelinux.org/",
     },
     platforms=["Linux", "Windows", "macOS"],
-    license="GPLv3",
+    license="GPLv3+",
     classifiers=[
-        "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
+        "License :: OSI Approved ::"
+        " GNU General Public License v3 or later (GPLv3+)",
         "Environment :: MacOS X",
         "Environment :: Win32 (MS Windows)",
         "Environment :: X11 Applications",
@@ -337,7 +338,7 @@
     keywords="Development PyQt6 IDE Python3",
     python_requires=">=3.7",
     install_requires=[
-        "pip>=19.0",
+        "pip>=21.1",
         "wheel",
         "PyQt6>=6.2.0",
         "PyQt6-Charts>=6.2.0",

eric ide

mercurial