Lines 82-87
Link Here
|
82 |
# |
82 |
# |
83 |
# cython_run - Depend on lang/cython at run-time. |
83 |
# cython_run - Depend on lang/cython at run-time. |
84 |
# |
84 |
# |
|
|
85 |
# django - Depend on the Django framework |
86 |
# |
87 |
# Valid ARGS: <version>, build, run, test |
88 |
# |
89 |
# <version> usage: |
90 |
# |
91 |
# django # Use the set default Django |
92 |
# django:1.11 # Only use Django 1.11 |
93 |
# django:1.11+ # Use Django 1.11 or newer |
94 |
# django:1.11-2.0 # Use Django 1.11 or 2.0 |
95 |
# django:-2.0 # Use any Django up to 2.0 |
96 |
# |
97 |
# build Indicates, that Django is needed at |
98 |
# build time and adds it to BUILD_DEPENDS |
99 |
# |
100 |
# run Indicates, that Django is needed at |
101 |
# run time and adds it to RUN_DEPENDS |
102 |
# |
103 |
# test Indicates, that Django is needed at |
104 |
# test time and adds it to TEST_DEPENDS |
105 |
# |
85 |
# flavors - Force creation of flavors for Python 2 and 3 default |
106 |
# flavors - Force creation of flavors for Python 2 and 3 default |
86 |
# versions, where applicable. |
107 |
# versions, where applicable. |
87 |
# |
108 |
# |
Lines 249-257
Link Here
|
249 |
_PYTHON_BASECMD= ${LOCALBASE}/bin/python |
270 |
_PYTHON_BASECMD= ${LOCALBASE}/bin/python |
250 |
_PYTHON_RELPORTDIR= lang/python |
271 |
_PYTHON_RELPORTDIR= lang/python |
251 |
|
272 |
|
|
|
273 |
# What Django versions are currently supported? |
274 |
# When adding a version, please keep the comment in |
275 |
# Mk/bsd.default-versions.mk in sync. |
276 |
_DJANGO_VERSIONS= 1.11 2.0 2.1 |
277 |
|
252 |
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME> |
278 |
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME> |
253 |
.for var in ${USE_PYTHON} |
279 |
.for var in ${USE_PYTHON} |
254 |
_PYTHON_FEATURE_${var:C/=.*$//:tu}= ${var:C/.*=//:S/,/ /g} |
280 |
_PYTHON_FEATURE_${var:C/\:.*//:tu}= ${var:C/\:.*//:S/,/ /g} |
|
|
281 |
# Were arguments supplied? If so, assign them to another variable |
282 |
# At the moment this is only used for the django feature |
283 |
.if !defined(_PYTHON_FEATURE_${var:C/\:.*//:tu}_ARGS) |
284 |
_PYTHON_FEATURE_${var:C/\:.*//:tu}_ARGS= ${var:C/^[^\:]*(\:|\$)//:S/,/ /g} |
285 |
.endif |
255 |
.endfor |
286 |
.endfor |
256 |
|
287 |
|
257 |
# distutils automatically generates flavors depending on the supported |
288 |
# distutils automatically generates flavors depending on the supported |
Lines 559-564
Link Here
|
559 |
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} |
590 |
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:devel/py-setuptools@${PY_FLAVOR} |
560 |
.endif |
591 |
.endif |
561 |
|
592 |
|
|
|
593 |
# Django framework support |
594 |
# WIP: Packaging / flavors for Django ports? |
595 |
# |
596 |
# Process-Flow: |
597 |
# - Parse for build, run and test arguments |
598 |
# - Check for set Django version from user/framework |
599 |
# - Get minimum/maximum Django version from Makefile of port |
600 |
# - Split Django versions into major/minor numbers, e.g. 1.11 will be |
601 |
# splitted into major 1 and minor 11 . |
602 |
# - Compare splitted user/ports framework Django version against splitted |
603 |
# minimum/maximum Django versions of ports |
604 |
# - Handle unsupported versions of Django |
605 |
# - Set the Django dependencies |
606 |
.if defined(_PYTHON_FEATURE_DJANGO) |
607 |
######### |
608 |
### Parse for build, run and test arguments |
609 |
### |
610 |
# Reset the variables just to be sure |
611 |
.undef _PYTHON_DJANGO_BUILD_DEP |
612 |
.undef _PYTHON_DJANGO_RUN_DEP |
613 |
.undef _PYTHON_DJANGO_TEST_DEP |
614 |
# Parse for build ,run and test arguments and if found, remove them afterwards |
615 |
.if ${_PYTHON_FEATURE_DJANGO_ARGS:Mbuild} |
616 |
_PYTHON_DJANGO_BUILD_DEP= yes |
617 |
_PYTHON_FEATURE_DJANGO_ARGS:= ${_PYTHON_FEATURE_DJANGO_ARGS:Nbuild} |
618 |
.endif |
619 |
.if ${_PYTHON_FEATURE_DJANGO_ARGS:Mrun} |
620 |
_PYTHON_DJANGO_RUN_DEP= yes |
621 |
_PYTHON_FEATURE_DJANGO_ARGS:= ${_PYTHON_FEATURE_DJANGO_ARGS:Nrun} |
622 |
.endif |
623 |
.if ${_PYTHON_FEATURE_DJANGO_ARGS:Mtest} |
624 |
_PYTHON_DJANGO_TEST_DEP= yes |
625 |
_PYTHON_FEATURE_DJANGO_ARGS:= ${_PYTHON_FEATURE_DJANGO_ARGS:Ntest} |
626 |
.endif |
627 |
# The port does not specify a build, run or test dependency, assume all are required. |
628 |
.if !defined(_PYTHON_DJANGO_BUILD_DEP) && !defined(_PYTHON_DJANGO_RUN_DEP) && \ |
629 |
!defined(_PYTHON_DJANGO_TEST_DEP) |
630 |
_PYTHON_DJANGO_BUILD_DEP= yes |
631 |
_PYTHON_DJANGO_RUN_DEP= yes |
632 |
_PYTHON_DJANGO_TEST_DEP= yes |
633 |
.endif |
634 |
|
635 |
######### |
636 |
### Check for set Django version from user/framework |
637 |
### |
638 |
# Check if the user has given the desired Django version |
639 |
.if defined(DJANGO_VERSION) |
640 |
# A port/user requests a specific django version for its dependencies via |
641 |
# DEPENDS_ARGS, since it requires the specific django version itself. |
642 |
# Several things can happen now: |
643 |
# a) the dependency supports the requested version -> everything's fine |
644 |
# b) the dependency does not support the requested version |
645 |
# 1) the dependency works in a way that the different django |
646 |
# versions do not matter -> everything's fine |
647 |
# 2) the dependency is likely to break due to the conflict |
648 |
# nothing's fine |
649 |
# |
650 |
# b.2) needs to be resolved. Due to the complexity of how different pieces of |
651 |
# software are built, we can't solve this automatically. Instead, let's assume |
652 |
# that maintainers know what they are doing and assume DJANGO_VERSION to be a |
653 |
# hint. Just warn maintainers, if the versions do not match |
654 |
# (_DJANGO_VERSION_NONSUPPORTED). |
655 |
_DJANGO_VERSION:= ${DJANGO_VERSION:S/^django//} |
656 |
.else |
657 |
_DJANGO_VERSION:= ${DJANGO_DEFAULT} |
658 |
.endif # if defined(DJANGO_VERSION) |
659 |
|
660 |
######### |
661 |
### Get the minimum/maximum Django version from the Makefile of the port |
662 |
### |
663 |
# Get and prepare the Django version(s) given in the Makefile |
664 |
_DJANGO_VERSION_CHECK= ${_PYTHON_FEATURE_DJANGO_ARGS:C/^([1-9]\.[0-9]+)$/\1-\1/} |
665 |
|
666 |
# Get the minimum supported version |
667 |
_DJANGO_VERSION_MINIMUM_TMP:= ${_DJANGO_VERSION_CHECK:C/([1-9]\.[0-9]+)[-+].*/\1/} |
668 |
_DJANGO_VERSION_MINIMUM:= ${_DJANGO_VERSION_MINIMUM_TMP:M[1-9].[0-9][0-9]} |
669 |
# Fallback for versions with 1.X versioning scheme |
670 |
.if empty(_DJANGO_VERSION_MINIMUM) |
671 |
_DJANGO_VERSION_MINIMUM:= ${_DJANGO_VERSION_MINIMUM_TMP:M[1-9].[0-9]} |
672 |
.endif |
673 |
# Get the maximum supported version |
674 |
_DJANGO_VERSION_MAXIMUM_TMP:= ${_DJANGO_VERSION_CHECK:C/.*-([1-9]\.[0-9]+)/\1/} |
675 |
_DJANGO_VERSION_MAXIMUM:= ${_DJANGO_VERSION_MAXIMUM_TMP:M[1-9].[0-9][0-9]} |
676 |
# Fallback for versions with 1.X versioning scheme |
677 |
.if empty(_DJANGO_VERSION_MAXIMUM) |
678 |
_DJANGO_VERSION_MAXIMUM:= ${_DJANGO_VERSION_MAXIMUM_TMP:M[1-9].[0-9]} |
679 |
.endif |
680 |
|
681 |
# Reset _DJANGO_VERSION_NONSUPPORTED just to be sure |
682 |
.undef _DJANGO_VERSION_NONSUPPORTED |
683 |
|
684 |
######### |
685 |
### Split Django versions into major/minor numbers |
686 |
### |
687 |
# Split the given Django version (framework/user) into major and minor versions |
688 |
# Get the major version number |
689 |
_DJANGO_VERSION_MAJOR_TMP:= ${_DJANGO_VERSION:C/^([1-9]).*/\1/} |
690 |
_DJANGO_VERSION_MAJOR:= ${_DJANGO_VERSION_MAJOR_TMP:M[1-9]} |
691 |
# Get the minor version number |
692 |
_DJANGO_VERSION_MINOR_TMP:= ${_DJANGO_VERSION:C/.*\.([0-9]+)$/\1/} |
693 |
_DJANGO_VERSION_MINOR:= ${_DJANGO_VERSION_MINOR_TMP:M[0-9][0-9]} |
694 |
# Fallback for versions with 1.X versioning scheme |
695 |
.if empty(_DJANGO_VERSION_MINOR) |
696 |
_DJANGO_VERSION_MINOR:= ${_DJANGO_VERSION_MINOR_TMP:M[0-9]} |
697 |
.endif |
698 |
|
699 |
# If set, split up the minimum version (from makefile) into major and minor versions |
700 |
.if !empty(_DJANGO_VERSION_MINIMUM) |
701 |
# Get the major version number |
702 |
_DJANGO_VERSION_MINIMUM_MAJOR_TMP:= ${_DJANGO_VERSION_MINIMUM:C/^([1-9]).*/\1/} |
703 |
_DJANGO_VERSION_MINIMUM_MAJOR:= ${_DJANGO_VERSION_MINIMUM_MAJOR_TMP:M[1-9]} |
704 |
# Get the minor version number |
705 |
_DJANGO_VERSION_MINIMUM_MINOR_TMP:= ${_DJANGO_VERSION_MINIMUM:C/.*\.([0-9]+)$/\1/} |
706 |
_DJANGO_VERSION_MINIMUM_MINOR:= ${_DJANGO_VERSION_MINIMUM_MINOR_TMP:M[0-9][0-9]} |
707 |
# Fallback for versions with 1.X versioning scheme |
708 |
.if empty(_DJANGO_VERSION_MINIMUM_MINOR) |
709 |
_DJANGO_VERSION_MINIMUM_MINOR:= ${_DJANGO_VERSION_MINIMUM_MINOR_TMP:M[0-9]} |
710 |
.endif |
711 |
.endif # !empty(_DJANGO_VERSION_MINIMUM) |
712 |
|
713 |
# If set, split up the maximum version (from makefile) into major and minor versions |
714 |
.if !empty(_DJANGO_VERSION_MAXIMUM) |
715 |
# Get the major version number |
716 |
_DJANGO_VERSION_MAXIMUM_MAJOR_TMP:= ${_DJANGO_VERSION_MAXIMUM:C/^([1-9]).*/\1/} |
717 |
_DJANGO_VERSION_MAXIMUM_MAJOR:= ${_DJANGO_VERSION_MAXIMUM_MAJOR_TMP:M[1-9]} |
718 |
# Get the minor version number |
719 |
_DJANGO_VERSION_MAXIMUM_MINOR_TMP:= ${_DJANGO_VERSION_MAXIMUM:C/.*\.([0-9]+)$/\1/} |
720 |
_DJANGO_VERSION_MAXIMUM_MINOR:= ${_DJANGO_VERSION_MAXIMUM_MINOR_TMP:M[0-9][0-9]} |
721 |
# Fallback for versions with 1.X versioning scheme |
722 |
.if empty(_DJANGO_VERSION_MAXIMUM_MINOR) |
723 |
_DJANGO_VERSION_MAXIMUM_MINOR:= ${_DJANGO_VERSION_MAXIMUM_MINOR_TMP:M[0-9]} |
724 |
.endif |
725 |
.endif # !empty(_DJANGO_VERSION_MAXIMUM) |
726 |
|
727 |
# Check the given Django version (ports framework/user) against the minimum |
728 |
# version from the makefile |
729 |
.if !empty(_DJANGO_VERSION_MINIMUM) |
730 |
.if (${_DJANGO_VERSION_MAJOR} <= ${_DJANGO_VERSION_MINIMUM_MAJOR}) && \ |
731 |
(${_DJANGO_VERSION_MINOR} < ${_DJANGO_VERSION_MINIMUM_MINOR}) |
732 |
_DJANGO_VERSION_NONSUPPORTED= ${_DJANGO_VERSION_MINIMUM} at least |
733 |
.endif |
734 |
.endif # !empty(_DJANGO_VERSION_MINIMUM) |
735 |
|
736 |
# Check the given Django version (ports framework/user) against the maximum |
737 |
# version from the makefile |
738 |
.if !empty(_DJANGO_VERSION_MAXIMUM) |
739 |
.if (${_DJANGO_VERSION_MAJOR} >= ${_DJANGO_VERSION_MAXIMUM_MAJOR}) && \ |
740 |
(${_DJANGO_VERSION_MINOR} > ${_DJANGO_VERSION_MAXIMUM_MINOR}) |
741 |
_DJANGO_VERSION_NONSUPPORTED= ${_DJANGO_VERSION_MAXIMUM} at most |
742 |
.endif |
743 |
.endif # !empty(_DJANGO_VERSION_MAXIMUM) |
744 |
|
745 |
######### |
746 |
# Handle unsupported versions of Django |
747 |
### |
748 |
.if defined(_DJANGO_VERSION_NONSUPPORTED) |
749 |
# If user has specified a Django version |
750 |
#.if defined(DJANGO_VERSION) |
751 |
_DV:= ${_DJANGO_VERSION} # preserve the specified django version |
752 |
IGNORE= needs Django ${_DJANGO_VERSION_NONSUPPORTED}, but ${_DV} was specified |
753 |
#.endif # defined(DJANGO_VERSION) |
754 |
|
755 |
# Reset _DJANGO_VERSION |
756 |
.undef _DJANGO_VERSION |
757 |
|
758 |
#.for dver in ${DJANGO_DEFAULT} ${_DJANGO_VERSIONS} |
759 |
#__DVER= ${dver} |
760 |
# Split up the Django version into major and minor versions |
761 |
# Get the major version number |
762 |
#__DVER_MAJOR_TMP= ${__DVER:C/^([1-9]).*/\1/} |
763 |
#__DVER_MAJOR= ${__DVER_MAJOR_TMP:M[1-9]} |
764 |
# Get the minor version number |
765 |
#__DVER_MINOR_TMP= ${__DVER:C/.*\.([0-9]+)$/\1/} |
766 |
#__DVER_MINOR= ${__DVER_MINOR_TMP:M[0-9][0-9]} |
767 |
# Fall back for versions with 1.X versioning scheme |
768 |
#.if empty(__DVER_MINOR) |
769 |
#__DVER_MINOR= ${__DVER_MINOR_TMP:M[0-9]} |
770 |
#.endif |
771 |
|
772 |
# Compare the Django version with the available Django versions in the ports |
773 |
# framework |
774 |
#.if !defined(_DJANGO_VERSION) |
775 |
#.if !(!empty(_DJANGO_VERSION_MINIMUM) && ( \ |
776 |
(${__DVER_MAJOR} < ${_DJANGO_VERSION_MINIMUM_MAJOR}) && \ |
777 |
(${__DVER_MINOR} < ${_DJANGO_VERSION_MINIMUM_MINOR})) \ |
778 |
) && \ |
779 |
!(!empty(_DJANGO_VERSION_MAXIMUM) && ( \ |
780 |
(${__DVER_MAJOR} > ${_DJANGO_VERSION_MAXIMUM_MAJOR}) && \ |
781 |
(${__DVER_MINOR} > ${_DJANGO_VERSION_MAXIMUM_MINOR})) \ |
782 |
) |
783 |
#_DJANGO_VERSION= ${dver} |
784 |
#.endif # !empty(_DJANGO_VERSION_MINIMUM [...] |
785 |
#.endif # !defined(_DJANGO_VERSION |
786 |
#.endfor # dver in ${DJANGO_DEFAULT} ${_DJANGO_VERSIONS} |
787 |
|
788 |
#.if !defined(_DJANGO_VERSION) |
789 |
#IGNORE= needs an unsupported version of Django |
790 |
#.endif |
791 |
.endif # defined(_DJANGO_VERSION_NONSUPPORTED) |
792 |
|
793 |
# Pass DJANGO_VERSION down the dependency chain. This ensures that |
794 |
# port A -> B -> C all will use the same django version and do not |
795 |
# try to find a different one, if the passed version fits into |
796 |
# the supported version range. |
797 |
DJANGO_VERSION?= django${_DJANGO_VERSION} |
798 |
.if ${DJANGO_VERSION} != django${DJANGO_DEFAULT} |
799 |
DEPENDS_ARGS+= DJANGO_VERSION=${DJANGO_VERSION} |
800 |
.endif |
801 |
|
802 |
######### |
803 |
### Set the Django dependencies |
804 |
### |
805 |
.if defined(_DJANGO_VERSION) |
806 |
_DJANGO_PACKAGE= ${PYTHON_PKGNAMEPREFIX}django${_DJANGO_VERSION:S/.//}>=${_DJANGO_VERSION}:www/py-django${_DJANGO_VERSION:S/.//}@${PY_FLAVOR} |
807 |
.if defined(_PYTHON_DJANGO_BUILD_DEP) |
808 |
BUILD_DEPENDS+= ${_DJANGO_PACKAGE} |
809 |
.if !defined(_PYTHON_BUILD_DEP) |
810 |
WARNING+= "django,build was set but not for Python!" |
811 |
.endif |
812 |
.endif |
813 |
|
814 |
.if defined(_PYTHON_DJANGO_RUN_DEP) |
815 |
RUN_DEPENDS+= ${_DJANGO_PACKAGE} |
816 |
.if !defined(_PYTHON_RUN_DEP) |
817 |
WARNING+= "django,run was set but not for Python!" |
818 |
.endif |
819 |
.endif |
820 |
|
821 |
.if defined(_PYTHON_DJANGO_TEST_DEP) |
822 |
TEST_DEPENDS+= ${_DJANGO_PACKAGE} |
823 |
.if !defined(_PYTHON_TEST_DEP) |
824 |
WARNING+= "django,test was set but not for Python!" |
825 |
.endif |
826 |
.endif |
827 |
|
828 |
.endif # if defined(_DJANGO_VERSION) |
829 |
.endif # defined(_PYTHON_FEATURE_DJANGO) |
830 |
|
562 |
# distutils support |
831 |
# distutils support |
563 |
PYSETUP?= setup.py |
832 |
PYSETUP?= setup.py |
564 |
PYDISTUTILS_SETUP?= -c \ |
833 |
PYDISTUTILS_SETUP?= -c \ |