Skip to content

Commit 52d9cf2

Browse files
author
Eric Cheng
committed
initial changes
1 parent 96039f1 commit 52d9cf2

File tree

9 files changed

+34
-24
lines changed

9 files changed

+34
-24
lines changed

examples/searchcommands_app/package/bin/countmatches.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
20-
21-
from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators
2220
import sys
23-
from splunklib import six
21+
22+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
23+
from packages.splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators
24+
from packages.splunklib import six
2425

2526

2627
@Configuration()

examples/searchcommands_app/package/bin/filter.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
2020

21-
from splunklib.searchcommands import dispatch, EventingCommand, Configuration, Option
22-
from splunklib.searchcommands.validators import Code
23-
2421
import sys
2522

23+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
24+
from packages.splunklib.searchcommands import dispatch, EventingCommand, Configuration, Option
25+
from packages.splunklib.searchcommands.validators import Code
26+
27+
2628

2729
@Configuration()
2830
class FilterCommand(EventingCommand):

examples/searchcommands_app/package/bin/generatehello.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
20-
21-
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
2220
import sys
2321
import time
22+
23+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
24+
from packages.splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
2425
from six.moves import range
2526

2627

examples/searchcommands_app/package/bin/generatetext.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
20-
21-
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
2220
import sys
2321
import time
24-
from splunklib import six
25-
from splunklib.six.moves import range
22+
23+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
24+
from packages.splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
25+
from packages.splunklib import six
26+
from packages.splunklib.six.moves import range
2627

2728

2829
@Configuration()

examples/searchcommands_app/package/bin/pypygeneratetext.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@
6363

6464
from __future__ import absolute_import, division, print_function, unicode_literals
6565
import app
66+
import sys
6667

67-
from splunklib.searchcommands import app_root, execute
68+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
69+
from packages.splunklib.searchcommands import app_root, execute
6870
from os import environ, path
6971

70-
import sys
7172

7273
pypy_argv = ['pypy', path.join(app_root, 'bin', 'generatetext.py')] + sys.argv[1:]
7374
pypy_environ = dict(environ)

examples/searchcommands_app/package/bin/simulate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
2020

21-
from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
2221
import random
2322
import csv
2423
import sys
2524
import time
2625

26+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
27+
from packages.splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators
28+
2729

2830
@Configuration()
2931
class SimulateCommand(GeneratingCommand):

examples/searchcommands_app/package/bin/sum.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717

1818
from __future__ import absolute_import, division, print_function, unicode_literals
1919
import app
20-
21-
from splunklib.searchcommands import dispatch, ReportingCommand, Configuration, Option, validators
2220
import sys
2321

22+
sys.path.append(make_splunkhome_path(['etc', 'apps', 'searchcommands_app', 'lib']))
23+
from packages.splunklib.searchcommands import dispatch, ReportingCommand, Configuration, Option, validators
24+
2425

2526
@Configuration(requires_preop=True)
2627
class SumCommand(ReportingCommand):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/xcheng/repo/github/splunk-sdk-python/splunklib

examples/searchcommands_app/setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def install_packages(app_root, distribution):
8888
if not requires:
8989
return
9090

91-
target = os.path.join(app_root, 'bin', 'packages')
91+
target = os.path.join(app_root, 'lib', 'packages')
9292

9393
if not os.path.isdir(target):
9494
os.mkdir(target)
@@ -323,7 +323,7 @@ def run(self):
323323
message = 'Cannot create a link at "{}" because a file by that name already exists.'.format(target)
324324
raise SystemError(message)
325325

326-
packages = os.path.join(self.app_source, 'bin', 'packages')
326+
packages = os.path.join(self.app_source, 'lib', 'packages')
327327

328328
if not os.path.isdir(packages):
329329
os.mkdir(packages)
@@ -454,13 +454,13 @@ def run(self):
454454
'Topic :: System :: Logging',
455455
'Topic :: System :: Monitoring'],
456456
packages=[
457-
'bin.packages.splunklib', 'bin.packages.splunklib.searchcommands'
457+
'lib.packages.splunklib', 'lib.packages.splunklib.searchcommands'
458458
],
459459
package_dir={
460-
'bin': os.path.join('package', 'bin'),
461-
'bin.packages': os.path.join('package', 'bin', 'packages'),
462-
'bin.packages.splunklib': os.path.join('..', '..', 'splunklib'),
463-
'bin.packages.splunklib.searchcommands': os.path.join('..', '..', 'splunklib', 'searchcommands')
460+
'lib': os.path.join('package', 'lib'),
461+
'lib.packages': os.path.join('package', 'lib', 'packages'),
462+
'lib.packages.splunklib': os.path.join('..', '..', 'splunklib'),
463+
'lib.packages.splunklib.searchcommands': os.path.join('..', '..', 'splunklib', 'searchcommands')
464464
},
465465
package_data={
466466
'bin': [

0 commit comments

Comments
 (0)