]> granicus.if.org Git - liblinear/commitdiff
updated setup.py for license
authorSinacam <stinkingmadgod@gmail.com>
Thu, 27 Oct 2022 16:23:52 +0000 (00:23 +0800)
committerSinacam <stinkingmadgod@gmail.com>
Thu, 27 Oct 2022 16:23:52 +0000 (00:23 +0800)
python/setup.py

index 9a4c1fab2af42c585c34a5dc7e633e48362415c6..e1c2575709ad09630b5a01499e20195ed5f90b57 100644 (file)
@@ -38,6 +38,11 @@ headers = [
     "linear.def",
 ]
 
+# license parameters
+license_source = path.join("..", "COPYRIGHT")
+license_file = "LICENSE"
+license_name = "BSD-3-Clause"
+
 kwargs_for_extension = {
     "sources": [path.join(cpp_dir, f) for f in source_codes],
     "depends": [path.join(cpp_dir, f) for f in headers],
@@ -67,7 +72,7 @@ def create_cpp_source():
 class CleanCommand(clean_cmd):
     def run(self):
         clean_cmd.run(self)
-        to_be_removed = ["build/", "dist/", "MANIFEST", cpp_dir, "{}.egg-info".format(PACKAGE_NAME)]
+        to_be_removed = ["build/", "dist/", "MANIFEST", cpp_dir, "{}.egg-info".format(PACKAGE_NAME), license_file]
         to_be_removed += glob("./{}/{}.*".format(PACKAGE_DIR, dynamic_lib_name))
         for root, dirs, files in os.walk(os.curdir, topdown=False):
             if "__pycache__" in dirs:
@@ -87,6 +92,9 @@ def main():
     if not path.exists(cpp_dir):
         create_cpp_source()
 
+    if not path.exists(license_file):
+        copyfile(license_source, license_file)
+
     with open("README") as f:
         long_description = f.read()
 
@@ -100,6 +108,7 @@ def main():
         author="ML group @ National Taiwan University",
         author_email="cjlin@csie.ntu.edu.tw",
         url="https://www.csie.ntu.edu.tw/~cjlin/liblinear",
+        license=license_name,
         install_requires=["scipy"],
         ext_modules=[
             Extension(