Repository: tern-tools/tern (language: python)

Issue:
Revert #977 after there is a fix for https://github.com/nexB/scancode-toolkit/issues/2529
Background:

We are unable to run scancode currently. A fix is in place. Meanwhile, we will fix scancode's dependencies such that it will work with Tern's dockerfile.

Remove requirements.scancode.txt
**Description**
Now that we have updated the dependencies, we can unpin scancode dependencies in Dockerfile.scancode

**To Do**
1. In `docker/Dockerfile.scancode` make the following changes:
a. remove lines
```
+COPY docker/requirements.scancode.txt /install/requirements.scancode.txt
+RUN pip install -r /install/requirements.scancode.txt
```
b. add this:
```
 RUN pip install --no-warn-script-location --prefix=/install \
    tern \
    scancode-toolkit[full]
```
2. Remove file `requirements.scancode.txt`

**Background**
See #978 



Discussion / hints:
@JeroenKnoops @JamieMagee https://github.com/nexB/scancode-toolkit/issues/2529 has been fixed so I will revert the changes to include the frozen dependencies in the Dockerfile :)
Oops! I meant to tag @maxhbr. Sorry!
@nishakm can we close this?
@rnjudge Not yet. Due to the dependency of the last tern release on an older version of debian-inspector, reverting this change now will break operation again. So we need a new tern release before reverting it.


Fix patch:
diff --git a/docker/Dockerfile.scancode b/docker/Dockerfile.scancode
index 16abfc5c..b6ea884d 100644
--- a/docker/Dockerfile.scancode
+++ b/docker/Dockerfile.scancode
@@ -16,9 +16,10 @@ RUN apt-get update \
 RUN pip install --no-warn-script-location --prefix=/install \
     tern
 
-COPY docker/requirements.scancode.txt /install/requirements.scancode.txt
-RUN pip install --prefix=/install \
-    -r /install/requirements.scancode.txt
+RUN pip install --no-warn-script-location --prefix=/install \
+    tern \
+    scancode-toolkit[full]
+
 
 FROM base
 
diff --git a/docker/requirements.scancode.txt b/docker/requirements.scancode.txt
deleted file mode 100644
index 9e855ed8..00000000
--- a/docker/requirements.scancode.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-appdirs==1.4.4
-attrs==21.2.0
-banal==1.0.6
-beautifulsoup4==4.9.3
-binaryornot==0.4.4
-bitarray==0.9.3
-boolean.py==3.8
-certifi==2020.12.5
-cffi==1.14.5
-chardet==4.0.0
-click==7.1.2
-colorama==0.4.4
-commoncode==21.5.25
-cryptography==3.4.7
-debian-inspector==21.5.25
-distlib==0.3.1
-dparse2==0.5.0.4
-extractcode==21.2.24
-extractcode-7z==16.5.210223
-extractcode-libarchive==3.5.1.210223
-fasteners==0.16
-filelock==3.0.12
-fingerprints==1.0.3
-ftfy==4.4.3
-future==0.18.2
-gemfileparser==0.8.0
-html5lib==1.1
-idna==2.10
-intbitset==2.4.1
-isodate==0.6.0
-jaraco.functools==3.3.0
-javaproperties==0.8.0
-Jinja2==2.11.3
-joblib==1.0.1
-jsonstreams==0.6.0
-license-expression==1.2
-lxml==4.6.3
-MarkupSafe==2.0.1
-more-itertools==8.8.0
-nltk==3.6.2
-normality==2.2.2
-packageurl-python==0.9.4
-packaging==20.9
-patch==1.16
-pdfminer.six==20201018
-pefile==2021.5.24
-pkginfo==1.7.0
-pluggy==0.13.1
-plugincode==21.1.21
-ply==3.11
-publicsuffix2==2.20191221
-pyahocorasick==1.4.2
-pycparser==2.20
-pycryptodome==3.10.1
-Pygments==2.9.0
-pymaven-patch==0.3.0
-pyparsing==2.4.7
-PyYAML==5.4.1
-rdflib==5.0.0
-regex==2021.4.4
-requests==2.25.1
-saneyaml==0.5.2
-scancode-toolkit==21.3.31
-six==1.16.0
-sortedcontainers==2.4.0
-soupsieve==2.2.1
-spdx-tools==0.6.1
-text-unidecode==1.3
-toml==0.10.2
-tqdm==4.61.0
-typecode==21.2.24
-typecode-libmagic==5.39.210223
-urllib3==1.26.5
-urlpy==0.5
-virtualenv==20.4.7
-wcwidth==0.2.5
-webencodings==0.5.1
-xmltodict==0.12.0


Test patch:
diff --git a/tests/test_class_package.py b/tests/test_class_package.py
index d8a38366..6ca9dc27 100644
--- a/tests/test_class_package.py
+++ b/tests/test_class_package.py
@@ -22,6 +22,7 @@ def setUp(self):
         self.p1.download_url = 'https://github.com'
         self.p1.checksum = '123abc456'
         self.p1.pkg_licenses = ['MIT', 'GPL']
+        self.p1.pkg_format = 'deb'
 
         self.p2 = Package('p2')
 
@@ -53,6 +54,7 @@ def testSetters(self):
         self.assertEqual(self.p2.download_url, 'https://github.com')
         self.p2.checksum = '123abc456'
         self.assertEqual(self.p2.checksum, '123abc456')
+        self.p2.pkg_format ='deb'
         self.p2.pkg_licenses = ['license1', 'license2']
         self.assertEqual(self.p2.pkg_licenses, ['license1', 'license2'])
         self.p2.files = [FileData('a', '/usr/abc/a'),
@@ -71,6 +73,7 @@ def testGetters(self):
         self.assertEqual(self.p1.download_url, 'https://github.com')
         self.assertEqual(self.p1.checksum, '123abc456')
         self.assertEqual(self.p1.pkg_licenses, ['MIT', 'GPL'])
+        self.assertEqual(self.p1.pkg_format, 'deb')
 
     def testAddFile(self):
         p1 = Package('package')
@@ -120,6 +123,7 @@ def testToDict(self):
         self.assertEqual(a_dict['files'][0]['name'], 'test.java')
         self.assertEqual(a_dict['files'][0]['path'], 'abc/pqr/test.java')
         self.assertEqual(a_dict['pkg_licenses'], ['MIT', 'GPL'])
+        self.assertEqual(a_dict['pkg_format'], 'deb')
 
     def testToDictTemplate(self):
         template1 = TestTemplate1()
@@ -143,10 +147,12 @@ def testIsEqual(self):
         p = Package('p2')
         p.pkg_license = 'Testpkg_license'
         p.version = '1.0'
+        p.pkg_format = 'rpm'
         p.proj_url = 'TestUrl'
         p.checksum = 'abcdef'
         self.p2.pkg_license = 'Testpkg_license'
         self.p2.version = '2.0'
+        self.p2.pkg_format = 'rpm'
         self.p2.proj_url = 'TestUrl'
         self.p2.checksum = 'abcdef'
         self.assertFalse(self.p2.is_equal(p))