# -*- coding: utf-8 -*-
"""
Data about OCA Projects, with a few helper functions.

OCA_PROJECTS: dictionary of OCA Projects mapped to the list of related
repository names, based on
https://community.odoo.com/page/website.projects_index

OCA_REPOSITORY_NAMES: list of OCA repository names

"""

ALL = ['OCA_PROJECTS', 'OCA_REPOSITORY_NAMES', 'url']

OCA_PROJECTS = {
    'accounting': ['account-analytic',
                   'account-budgeting',
                   'account-closing',
                   'account-consolidation',
                   'account-financial-tools',
                   'account-financial-reporting',
                   'account-invoice-reporting',
                   'account-invoicing',
                   'account-fiscal-rule',
                   ],
    ## 'backport': ['OCB',
    ##              ],
    'banking': ['banking',
                'bank-statement-reconcile',
                'account-payment',
                ],
    'community':['maintainers-tools',
                 'maintainer-quality-tools',
                 'runbot-addons',
                 ],
    'connector': ['connector',
                  'connector-ecommerce',
                  ],
    'account edge connector': ['connector-accountedge'],
    'connector lims': ['connector-lims'],
    'connector magento': ['connector-magento'],
    'connector prestashop': ['connector-prestashop'],
    'connector sage': ['connector-sage-50'],
    'crm sales': ['sale-workflow',
                  'crm',
                  'partner-contact',
                  'sale-financial',
                  'sale-reporting',
                  'commission',
                  ],
    'document': ['knowledge'],
    'ecommerce': ['e-commerce'],


    }

OCA_REPOSITORY_NAMES = []
for repos in OCA_PROJECTS.itervalues():
    OCA_REPOSITORY_NAMES += repos
OCA_REPOSITORY_NAMES.sort()

_OCA_REPOSITORY_NAMES = set(OCA_REPOSITORY_NAMES)

_URL_MAPPINGS = {'git': 'git@github.com:OCA/%s.git',
                 'https': 'https://github.com/OCA/%s.git',
                 }
def url(project_name, protocol='git'):
    """get the URL for an OCA project repository"""
    if project_name not in _OCA_REPOSITORY_NAMES:
        raise ValueError('Unknown project', project_name)
    return _URL_MAPPINGS[protocol] % project_name

@@ -1705,17 +1705,1962 @@
 erce'%5D,%0A
-%0A
+    'financial control': %5B'margin-analysis'%5D,%0A    'geospatial': %5B'geospatial'%5D,%0A    'hr': %5B'hr-timesheet',%0A           'hr',%0A           'department',%0A           %5D,%0A    'intercompany': %5B'mult-company'%5D,%0A    'l10n-belgium': %5B'l10n-belgium'%5D,%0A    'l10n-canada': %5B'l10n-canada'%5D,%0A    'l10n-france': %5B'l10n-france'%5D,%0A    'l10n-italy': %5B'l10n-italy'%5D,%0A    'l10n-luxemburg': %5B'l10n-luxemburg'%5D,%0A    'l10n-spain': %5B'l10n-spain'%5D,%0A    'l10n-switzerland': %5B'l10n-switzerland'%5D,%0A    'logistics': %5B'carrier-delivery',%0A                  'stock-logistics-barcode',%0A                  'stock-logistics-workflow',%0A                  'stock-logistics-tracking',%0A                  'stock-logistics-warehouse',%0A                  'stock-logistics-reporting',%0A                  'rma',%0A                  %5D,%0A    'manufacturing': %5B'manufacture',%0A                      'manufacture-reporting',%0A                      %5D,%0A    'management system': %5B'management-system'%5D,%0A    'template': %5B%5D,%0A    'purchase': %5B'purchase-workflow',%0A                 'purchase-reporting',%0A                 %5D,%0A    'product': %5B'product-attribute',%0A                'product-kitting',%0A                'product-variant',%0A                %5D,%0A    'project / services': %5B'project-reporting',%0A                           'project-service',%0A                           'contract',%0A                           'program',%0A                           %5D,%0A    'tools': %5B'reporting-engine',%0A              'report-print-send',%0A              'webkit-tools',%0A              'server-tools',%0A              'community-data-files',%0A              %5D,%0A    'vertical hotel': %5B'vertical-hotel'%5D,%0A    'vertical ISP': %5B'vertical-isp'%5D,%0A    'vertical editing': %5B'vertical-editing'%5D,%0A    'vertical medical': %5B'vertical-medical'%5D,%0A    'vertical NGO': %5B'vertical-ngo',%0A                     # XXX%0A                     %5D,%0A    'vertical construction': %5B'vertical-construction'%5D,%0A    'vertical travel': %5B'vertical-travel'%5D,%0A    'web': %5B'web'%5D,
 %0A    %7D%0A%0A

complete the list