Skip to content

Commit a38f6cf

Browse files
v1.45.2 (2020.04.28)
-------------------- * aditional functionality for PublisherHealper
1 parent a3d630c commit a38f6cf

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

GISPython/PublisherHealper.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Deployment publishing operations module
44
"""
55

6+
import codecs
67
import os
78
import shutil
89
import hashlib
@@ -47,6 +48,12 @@ class PublisherHealperConfig:
4748
# ]
4849
# }
4950
# ]
51+
replacementMap = {}
52+
# replacementMap = { # SAMPLE
53+
# 'test.json': {
54+
# '[find sting to replace]': 'replacement value'
55+
# }
56+
# }
5057
class PublisherHealper(object):
5158
"""Class for easing the Rar file operations"""
5259

@@ -332,6 +339,32 @@ def __do_process_json(self, config):
332339
params_helper.WriteParams(False)
333340
print u'... config file {} updated'.format(config_file['file'])
334341

342+
def __do_process_json(self, config):
343+
"""Replace required values by sring replacement
344+
345+
Args:
346+
self: The reserved object 'self'
347+
config ([PublisherHealperConfig]): Configuration of deplyment
348+
"""
349+
for file_name in config.replacementMap:
350+
replacement_map = config.replacementMap[file_name]
351+
path = os.path.join(config.destinationDir, file_name)
352+
_replace_in_file(path, replacement_map)
353+
print u'... file {} replaced strings'.format(path)
354+
355+
def _replace_in_file(path, replace_map):
356+
"""replaces values in files using replace_map
357+
"""
358+
with codecs.open(path, 'r') as f:
359+
newlines = []
360+
for line in f.readlines():
361+
for key, value in replace_map.items():
362+
line = line.replace(key, value)
363+
newlines.append(line)
364+
with open(path, 'w') as f:
365+
for line in newlines:
366+
f.write(line)
367+
335368
def _find_all_files(directory):
336369
"""Finds files in the directory
337370

GISPython/SysGISToolsSysParams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"""
33
Module for storing the scripting parameters
44
"""
5-
Version = 'GISPython Core 10.x - 1.45.0001' # GISPython full version name
5+
Version = 'GISPython Core 10.x - 1.45.0002' # GISPython full version name

docs/changelog.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
=========
22
Changelog
33
=========
4+
v1.45.2 (2020.04.28)
5+
--------------------
6+
* aditional functionality for PublisherHealper
7+
48
v1.45.1 (2019.15.12)
59
--------------------
610

@@ -74,7 +78,7 @@ v1.38.1 (2018.07.20)
7478

7579
* Bug fixes for GDPSyncroniserHelper2.py
7680
* Added parameter EnvironmentName. Used for Error Email generation, to indicate Environment in with error ocured.
77-
* Added SetupDefaultEnvironment.py module for fast environment setup.
81+
* Added SetupDefaultEnvironment.py module for fast environment setup.
7882

7983
v1.37.2 (2018.03.29)
8084
--------------------
@@ -144,4 +148,4 @@ v1.33.1 (2017.06.05)
144148
* Initial release
145149

146150
.. toctree::
147-
:maxdepth: 4
151+
:maxdepth: 4

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def get_version():
1818
setup(
1919
name = 'GISPython',
2020
version = get_version(), # version number according to PEP440 https://www.python.org/dev/peps/pep-0440/
21-
description = 'Additional tools for administering and automating different ArcPy and ArcGIS Server geoprocessing operations. Package is intended for use with ArcGIS 10.2.1 and later (has been tested on ArcGIS 10.4)', # short package description
21+
description = 'Additional tools for administering and automating different ArcPy and ArcGIS Server geoprocessing operations. Package is intended for use with ArcGIS 10.2.1 and later (has been tested on ArcGIS 10.3.1, ArcGIS 10.4, ArcGIS 10.5, ArcGIS 10.6.1)', # short package description
2222
long_description = 'For readme see GitHub https://github.com/lvmgeo/GISPython', # if needed (entire documentation)
2323
url = 'https://github.com/lvmgeo/GISPython', # GitHub url
2424
author = 'LVM GEO', # author
@@ -55,4 +55,4 @@ def get_version():
5555
# 'GISPython = __init__:main'
5656
# ]
5757
# },
58-
)
58+
)

0 commit comments

Comments
 (0)