Skip to content

Commit fbfbebb

Browse files
committed
fix minor errors
Signed-off-by: Varsha U N <[email protected]>
1 parent 86c0d23 commit fbfbebb

File tree

3 files changed

+12
-143
lines changed

3 files changed

+12
-143
lines changed

Dockerfile

Lines changed: 2 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,11 @@
11
<<<<<<< HEAD
22
<<<<<<< HEAD
33
<<<<<<< HEAD
4-
4+
55
=======
66
>>>>>>> b6d23428 (Revert "Revert "add tests for storing packages"")
77
=======
88
>>>>>>> 507231a0 (Revert "add tests for storing packages")
9-
# SPDX-License-Identifier: Apache-2.0
10-
#
11-
# http://nexb.com and https://github.com/aboutcode-org/scancode.io
12-
# The ScanCode.io software is licensed under the Apache License version 2.0.
13-
# Data generated with ScanCode.io is provided as-is without warranties.
14-
# ScanCode is a trademark of nexB Inc.
15-
#
16-
# You may not use this software except in compliance with the License.
17-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
18-
# Unless required by applicable law or agreed to in writing, software distributed
19-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
20-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
21-
# specific language governing permissions and limitations under the License.
22-
#
23-
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
24-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
25-
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
26-
# for any legal advice.
27-
#
28-
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
29-
# Visit https://github.com/aboutcode-org/scancode.io for support and download.
30-
31-
FROM python:3.13-slim
32-
33-
LABEL org.opencontainers.image.source="https://github.com/aboutcode-org/scancode.io"
34-
LABEL org.opencontainers.image.description="ScanCode.io"
35-
LABEL org.opencontainers.image.licenses="Apache-2.0"
36-
37-
ENV APP_NAME scancodeio
38-
ENV APP_USER app
39-
ENV APP_DIR /opt/$APP_NAME
40-
ENV VENV_LOCATION /opt/$APP_NAME/.venv
41-
42-
# Force Python unbuffered stdout and stderr (they are flushed to terminal immediately)
43-
ENV PYTHONUNBUFFERED 1
44-
# Do not write Python .pyc files
45-
ENV PYTHONDONTWRITEBYTECODE 1
46-
# Add the app dir in the Python path for entry points availability
47-
ENV PYTHONPATH $PYTHONPATH:$APP_DIR
48-
49-
# OS requirements as per
50-
# https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html
51-
# Also install universal-ctags and xgettext for symbol and string collection.
52-
RUN apt-get update \
53-
&& apt-get install -y --no-install-recommends \
54-
bzip2 \
55-
xz-utils \
56-
zlib1g \
57-
libxml2-dev \
58-
libxslt1-dev \
59-
libgomp1 \
60-
libsqlite3-0 \
61-
libgcrypt20 \
62-
libpopt0 \
63-
libzstd1 \
64-
libgpgme11 \
65-
libdevmapper1.02.1 \
66-
libguestfs-tools \
67-
linux-image-amd64 \
68-
git \
69-
wait-for-it \
70-
universal-ctags \
71-
gettext \
72-
&& apt-get clean \
73-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
74-
75-
# Create the APP_USER group and user
76-
RUN addgroup --system $APP_USER \
77-
&& adduser --system --group --home=$APP_DIR $APP_USER \
78-
&& chown $APP_USER:$APP_USER $APP_DIR
79-
80-
# Create the /var/APP_NAME directory with proper permission for APP_USER
81-
RUN mkdir -p /var/$APP_NAME \
82-
&& chown $APP_USER:$APP_USER /var/$APP_NAME
83-
84-
# Setup the work directory and the user as APP_USER for the remaining stages
85-
WORKDIR $APP_DIR
86-
USER $APP_USER
87-
88-
# Create the virtualenv
89-
RUN python -m venv $VENV_LOCATION
90-
# Enable the virtualenv, similar effect as "source activate"
91-
ENV PATH $VENV_LOCATION/bin:$PATH
92-
93-
# Create static/ and workspace/ directories
94-
RUN mkdir -p /var/$APP_NAME/static/ \
95-
&& mkdir -p /var/$APP_NAME/workspace/
96-
97-
# Install the dependencies before the codebase COPY for proper Docker layer caching
98-
COPY --chown=$APP_USER:$APP_USER pyproject.toml $APP_DIR/
99-
RUN pip install --no-cache-dir .
100-
101-
# Copy the codebase and set the proper permissions for the APP_USER
102-
<<<<<<< HEAD
103-
<<<<<<< HEAD
104-
COPY --chown=$APP_USER:$APP_USER . $APP_DIR
105-
=======
106-
COPY --chown=$APP_USER:$APP_USER . $APP_DIR
107-
>>>>>>> b6d23428 (Revert "Revert "add tests for storing packages"")
108-
=======
1099
# SPDX-License-Identifier: Apache-2.0
11010
#
11111
# http://nexb.com and https://github.com/aboutcode-org/scancode.io
@@ -200,7 +100,4 @@ RUN pip install --no-cache-dir .
200100

201101
# Copy the codebase and set the proper permissions for the APP_USER
202102
COPY --chown=$APP_USER:$APP_USER . $APP_DIR
203-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
204-
=======
205-
COPY --chown=$APP_USER:$APP_USER . $APP_DIR
206-
>>>>>>> 507231a0 (Revert "add tests for storing packages")
103+

scanpipe/pipelines/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
from functools import wraps
3030
from pathlib import Path
3131

32+
from django.conf import settings
33+
3234
import bleach
3335
from markdown_it import MarkdownIt
3436
from pyinstrument import Profiler
35-
from django.conf import settings
3637

3738
from aboutcode.pipeline import BasePipeline
3839
from scancodeio.settings import download_store
40+
3941
logger = logging.getLogger(__name__)
4042

4143

scanpipe/tests/test_pipelines.py

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
<<<<<<< HEAD
2-
<<<<<<< HEAD
3-
<<<<<<< HEAD
4-
<<<<<<< HEAD
5-
<<<<<<< HEAD
6-
7-
=======
8-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
91
# SPDX-License-Identifier: Apache-2.0
102
#
113
# http://nexb.com and https://github.com/nexB/scancode.io
@@ -37,10 +29,6 @@
3729
from pathlib import Path
3830
from unittest import mock
3931
from unittest import skipIf
40-
<<<<<<< HEAD
41-
=======
42-
from unittest.mock import patch
43-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
4432

4533
from django.conf import settings
4634
from django.test import TestCase
@@ -311,49 +299,31 @@ def test_archive_downloads(self, mock_get):
311299
with open(test_data_path, "rb") as f:
312300
test_content = f.read()
313301

314-
<<<<<<< HEAD
315-
input_source=InputSource.objects.create(
316-
=======
317-
InputSource.objects.create(
318-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
319-
project=project1,
320-
filename=test_filename,
321-
download_url=test_url,
322-
is_uploaded=False,
302+
input_source = InputSource.objects.create(
303+
InputSource.objects.create(
304+
project=project1,
305+
filename=test_filename,
306+
download_url=test_url,
307+
is_uploaded=False,
308+
)
323309
)
324-
<<<<<<< HEAD
325-
326-
=======
327-
328-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
329310
mock_get.return_value.content = test_content
330311
mock_get.return_value.status_code = 200
331312

332313
pipeline.download_missing_inputs()
333314
input_source.refresh_from_db()
334-
<<<<<<< HEAD
335315
self.assertTrue(
336316
input_source.file_path.startswith(settings.CENTRAL_ARCHIVE_PATH)
337317
)
338318
self.assertTrue(Path(input_source.file_path).exists())
339319

340-
=======
341-
self.assertTrue(input_source.file_path.startswith(settings.CENTRAL_ARCHIVE_PATH))
342-
self.assertTrue(Path(input_source.file_path).exists())
343-
344-
345-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
346320
pipeline.archive_downloads()
347321
input_source = InputSource.refresh_from_db()
348322
self.assertTrue(input_source.sha256)
349323
self.assertTrue(input_source.download_date)
350324
self.assertEqual(input_source.download_url, test_url)
351325
self.assertEqual(input_source.filename, test_filename)
352-
<<<<<<< HEAD
353326

354-
=======
355-
356-
>>>>>>> ca2f49f5 (Revert "Revert "Revert "add tests for storing packages""")
357327
project2 = make_project(name="project2")
358328
input_source2 = InputSource.objects.create(
359329
project=project2,

0 commit comments

Comments
 (0)