Remove egg-info without breaking locale extraction (#22384)
* Remove egg-info without breaking locale extraction * Merge setup to pyproject
This commit is contained in:
Родитель
59156f8674
Коммит
aa31195786
22
Dockerfile
22
Dockerfile
|
@ -48,10 +48,6 @@ RUN <<EOF
|
|||
mkdir /deps
|
||||
chown -R olympia:olympia /deps
|
||||
|
||||
# Remove any existing egg info directory and create a new one
|
||||
rm -rf ${HOME}/src/olympia.egg-info
|
||||
mkdir -p ${HOME}/src/olympia.egg-info
|
||||
chown olympia:olympia ${HOME}/src/olympia.egg-info
|
||||
|
||||
# For backwards-compatibility purposes, set up links to uwsgi. Note that
|
||||
# the target doesn't exist yet at this point, but it will later.
|
||||
|
@ -74,6 +70,8 @@ ENV PATH $PYTHONUSERBASE/bin:$PATH
|
|||
ENV NPM_CONFIG_PREFIX=/deps/
|
||||
ENV NPM_CACHE_DIR=/deps/cache/npm
|
||||
ENV NPM_DEBUG=true
|
||||
# Set python path to the project root and src to resolve olympia modules correctly
|
||||
ENV PYTHONPATH=${HOME}:${HOME}/src
|
||||
|
||||
# All we need in "base" is pip to be installed
|
||||
#this let's other layers install packages using the correct version.
|
||||
|
@ -136,18 +134,6 @@ RUN \
|
|||
# and copying only the static/ directory.
|
||||
FROM pip_production as assets
|
||||
|
||||
# TODO: This stage depends on `olympia` being installed.
|
||||
# We should decouple the logic from the `olympia` installation
|
||||
# So it can cache more efficiently
|
||||
RUN \
|
||||
# Files needed to run the make command
|
||||
--mount=type=bind,source=Makefile-docker,target=${HOME}/Makefile-docker \
|
||||
# Files required to install pip dependencies
|
||||
--mount=type=bind,source=setup.py,target=${HOME}/setup.py \
|
||||
--mount=type=bind,source=pyproject.toml,target=${HOME}/pyproject.toml \
|
||||
# Command to install dependencies
|
||||
make -f Makefile-docker update_deps_olympia
|
||||
|
||||
# TODO: only copy the files we need for compiling assets
|
||||
COPY --chown=olympia:olympia static/ ${HOME}/static/
|
||||
|
||||
|
@ -181,10 +167,6 @@ COPY --from=assets --chown=olympia:olympia ${HOME}/site-static ${HOME}/site-stat
|
|||
# inside the docker image, thus it's copied there.
|
||||
COPY version.json /app/version.json
|
||||
|
||||
# We have to reinstall olympia after copying source
|
||||
# to ensure the installation syncs files in the src/ directory
|
||||
RUN make -f Makefile-docker update_deps_olympia
|
||||
|
||||
FROM sources as development
|
||||
|
||||
# Copy dependencies from `pip_development`
|
||||
|
|
|
@ -130,10 +130,6 @@ update_deps_pip: ## Install pip
|
|||
rm -rf /deps/build/*
|
||||
$(PIP_COMMAND) install --progress-bar=off --no-deps --exists-action=w -r requirements/pip.txt
|
||||
|
||||
.PHONY: update_deps_olympia
|
||||
update_deps_olympia: ## Install the olympia local package
|
||||
# pep 517 mode (the default) breaks editable install in our project. https://github.com/mozilla/addons-server/issues/16144
|
||||
$(PIP_COMMAND) install --no-use-pep517 -e .
|
||||
|
||||
.PHONY: update_deps_development
|
||||
update_deps_development: ## update the python and node dependencies for development
|
||||
|
@ -146,7 +142,7 @@ update_deps_production: ## update the python and node dependencies for productio
|
|||
npm ci $(NPM_ARGS) --include=prod
|
||||
|
||||
.PHONY: update_deps
|
||||
update_deps: update_deps_pip update_deps_production update_deps_development update_deps_olympia## update the python and node dependencies
|
||||
update_deps: update_deps_pip update_deps_production update_deps_development ## update the python and node dependencies
|
||||
|
||||
.PHONY: prune_deps
|
||||
prune_deps: ## remove unused dependencies
|
||||
|
|
|
@ -4,3 +4,6 @@
|
|||
[django: src/olympia/**/templates/admin/**.html]
|
||||
[django: src/olympia/**/templates/devhub/forms/widgets/compat_app_input_option.html]
|
||||
[jinja2_custom: src/olympia/**/templates/**.html]
|
||||
|
||||
[extractors]
|
||||
jinja2_custom = olympia.core.babel:extract_jinja
|
||||
|
|
|
@ -45,10 +45,6 @@ services:
|
|||
- supervisord -n -c /data/olympia/docker/supervisor-celery.conf
|
||||
volumes:
|
||||
- .:/data/olympia
|
||||
# Exclude contents in this directory from mounting
|
||||
# Otherwise our `olympia` installation will be invalid
|
||||
# Causing failures or requiring re-installation of dependencies
|
||||
- /data/olympia/src/olympia.egg-info
|
||||
- storage:/data/olympia/storage
|
||||
extra_hosts:
|
||||
- "olympia.test:127.0.0.1"
|
||||
|
|
|
@ -1,3 +1,30 @@
|
|||
[build-system]
|
||||
requires = ["setuptools", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools]
|
||||
name = "olympia"
|
||||
version = "0.1.0"
|
||||
description = "This is https://addons.mozilla.org (AMO)"
|
||||
author = "The Mozilla Team"
|
||||
author_email = "amo-developers@mozilla.org"
|
||||
url = "https://addons.mozilla.org/"
|
||||
package_dir = {"" = "src"}
|
||||
packages = "find:" # This tells setuptools to use find_packages() to discover packages
|
||||
include_package_data = true
|
||||
zip_safe = false
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Web Environment",
|
||||
"Intended Audience :: End Users/Desktop",
|
||||
"License :: OSI Approved :: Mozilla Public License",
|
||||
"Operating System :: POSIX",
|
||||
"Programming Language :: Python",
|
||||
"Framework :: Django",
|
||||
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
||||
"Programming Language :: Python :: 3",
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
exclude = [
|
||||
"docs",
|
||||
|
|
|
@ -32,10 +32,9 @@ info "Extracting content strings..."
|
|||
python3 manage.py extract_content_strings
|
||||
|
||||
info "Extracting strings from python..."
|
||||
# We must set PYTHONPATH here because pybabel needs to be able to import our settings file from the root
|
||||
PYTHONPATH=. DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} pybabel extract -F babel.cfg -o "$LOCALE_TEMPLATE_DIR/django.pot" -c 'L10n:' -w 80 --version=1.0 --project=addons-server --copyright-holder=Mozilla .
|
||||
DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} pybabel extract -F babel.cfg -o "$LOCALE_TEMPLATE_DIR/django.pot" -c 'L10n:' -w 80 --version=1.0 --project=addons-server --copyright-holder=Mozilla .
|
||||
info "Extracting strings from javascript..."
|
||||
PYTHONPATH=. DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} pybabel extract -F babeljs.cfg -o "$LOCALE_TEMPLATE_DIR/djangojs.pot" -c 'L10n:' -w 80 --version=1.0 --project=addons-server --copyright-holder=Mozilla .
|
||||
DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} pybabel extract -F babeljs.cfg -o "$LOCALE_TEMPLATE_DIR/djangojs.pot" -c 'L10n:' -w 80 --version=1.0 --project=addons-server --copyright-holder=Mozilla .
|
||||
|
||||
pushd locale > /dev/null
|
||||
|
||||
|
|
34
setup.py
34
setup.py
|
@ -1,34 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
setup(
|
||||
name='olympia',
|
||||
version='0.1.0',
|
||||
description='This is https://addons.mozilla.org (AMO)',
|
||||
author='The Mozilla Team',
|
||||
author_email='amo-developers@mozilla.org',
|
||||
url='https://addons.mozilla.org/',
|
||||
package_dir={'': 'src'},
|
||||
packages=find_packages('src'),
|
||||
include_package_data=True,
|
||||
test_suite='.',
|
||||
zip_safe=False,
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Environment :: Web Environment',
|
||||
'Intended Audience :: End Users/Desktop',
|
||||
'License :: OSI Approved :: Mozilla Public License',
|
||||
'Operating System :: POSIX',
|
||||
'Programming Language :: Python',
|
||||
'Framework :: Django',
|
||||
'Topic :: Internet :: WWW/HTTP :: Browsers',
|
||||
'Programming Language :: Python :: 3',
|
||||
],
|
||||
entry_points={
|
||||
'babel.extractors': [
|
||||
'jinja2_custom = olympia.core.babel:extract_jinja',
|
||||
]
|
||||
},
|
||||
)
|
Загрузка…
Ссылка в новой задаче