Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
packaging_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
packaging_scripts
Commits
b393d9ce0e77
Commit
b393d9ce0e77
authored
9 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
Add script to order hgconf files
parent
443acb469510
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
order_hgconf.py
+133
-0
133 additions, 0 deletions
order_hgconf.py
with
133 additions
and
0 deletions
order_hgconf.py
0 → 100755
+
133
−
0
View file @
b393d9ce
#!/usr/bin/env python3
import
argparse
import
configparser
import
logging
MASTER_MODULE_LIST
=
'''
base_iban_streamline
base_res_users_streamline
board_alerts
external_job
irtweaks
partner_address
x_data_loader
web_sheet_full_width
web_sheet_full_width_selective
web_m2o_enhanced
web_m2x_options
document_attachment
advanced_filter
analytic_structure
l10n_eu_nace
partner_naf
crm_naf
crm_streamline
account_streamline
account_iban
account_credit_transfer
account_voucher_sepa
account_invoice_streamline
account_move_batch
account_move_batch_export
account_report_webkit
account_report_csv
account_streamline_damig
purchase_streamline
purchase_tracker
hr_expense_streamline
oemetasl
hr_streamline
portal_analytic_structure
account_asset_streamline
account_bank_reconciliation
account_move_reversal
fichesactions
event_streamline
hr_expense_event
auth_saml
oe_osrm
quotation_template_streamline
alternate_ledger
hr_holidays_streamline
report_py3o
email_template_streamline
hr_recruitment_streamline
sale_streamline
product_streamline
rrules
sale_affair
timesheet
calendar_fields
directory
account_chart_flat
customer_billing
purchase_ffepgv
report_webkit_ffepgv
hr_expense_ffepgv
account_invoice_ffepgv
account_formiris
account_invoice_formiris
account_report_formiris
elias
hr_expense_formiris
purchase_formiris
purchase_tracker_formiris
account_numergy
hr_expense_numergy
hr_holidays_numergy
hr_numergy
purchase_numergy
purchase_order_report_numergy
purchase_tracker_numergy
hr_recruitment_numergy
account_magency
report_webkit_magency
vco_dir
be_safe
vco_timesheet
project_dev
project_issue_streamline
marketing_campaign_tracker
xcg_login_page
crm_facilogi
sales_facilogi
partner_centrinffo
'''
.
split
()
if
__name__
==
'
__main__
'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--verbose
'
,
'
-v
'
,
action
=
'
count
'
)
parser
.
add_argument
(
'
hgconf
'
,
help
=
"
hgconf to rewrite
"
)
args
=
parser
.
parse_args
()
if
args
.
verbose
==
1
:
logging
.
basicConfig
(
level
=
logging
.
INFO
)
if
args
.
verbose
and
args
.
verbose
>
1
:
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
logging
.
debug
(
'
Opening %s
'
%
args
.
hgconf
)
hgconf
=
configparser
.
ConfigParser
()
hgconf
.
read
(
args
.
hgconf
)
logging
.
debug
(
hgconf
.
sections
())
# Stop if there is any unknown module
module_difference
=
set
(
hgconf
.
sections
())
-
set
(
MASTER_MODULE_LIST
)
if
module_difference
:
logging
.
critical
(
"
Unknown module in master list: %s
"
%
"
,
"
.
join
(
module_difference
))
exit
(
1
)
else
:
logging
.
debug
(
"
No unknown module
"
)
outconfig
=
configparser
.
ConfigParser
()
# reorder sections
for
module
in
MASTER_MODULE_LIST
:
if
module
in
hgconf
.
sections
():
outconfig
.
add_section
(
module
)
order
=
[
'
pulluri
'
,
'
layout
'
,
'
track
'
]
for
option
in
order
:
if
option
in
hgconf
[
module
]:
outconfig
[
module
][
option
]
=
hgconf
[
module
][
option
]
for
option
in
hgconf
[
module
]:
if
option
not
in
order
:
outconfig
[
module
][
option
]
=
hgconf
[
module
][
option
]
# Write result
with
open
(
args
.
hgconf
,
'
w
'
)
as
outfile
:
outconfig
.
write
(
outfile
)
logging
.
info
(
"
Done
"
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment